Link to home
Start Free TrialLog in
Avatar of Troudeloup
Troudeloup

asked on

c++ VS. python: hardware control.

my electronics class almost touched using computer to control hardware, but we ran out of time.   it was to be powered by and controlled through a COM port (like the old mouse port, remember?)  and DC motors and lights could be operated through that.


my question is though, the python.org headline picture shows a lot of electronics and stuff, I am wondering though,  is c++ better at controlling "simple"  stuff like DC motors , or maybe today python can do some of those as well?


I'd love to initiate hardware controls from python than c++ ( and i don't care if I am not as powerful, it's just easier to learn)



I guess my question is actually, how to start hardware stuff with python, or rather, how to start hardware design.
Avatar of IanTh
IanTh
Flag of United Kingdom of Great Britain and Northern Ireland image

python has no access to hardware
c and c++ can thats why a lot of apps are written in c
You can do whatever you want from python.

True you don't control memory addresses in python, but (a) usually it's not needed as you have hardware control through devices like COM-port which are easily accessible via file interface and
(b) python 2.5 has direct native dll access (ctypes module) which allow you access anything (ctypes is also available for earlier version of python).

In your case it should be extremely easy: type some char to COM to start/stop the motor.
ASKER CERTIFIED SOLUTION
Avatar of doraemon-nolife
doraemon-nolife

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial