c++  VS.  python:   hardware control.

Posted on 2007-07-20
Last Modified: 2013-12-27
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 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.
Question by:Troudeloup
    LVL 30

    Expert Comment

    python has no access to hardware
    c and c++ can thats why a lot of apps are written in c
    LVL 15

    Expert Comment

    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.
    LVL 4

    Accepted Solution

    Python cant do the control on hardware directly.

    However, you can call python from C program or call C program from python program. It is some sort like JNI in java.

    Check these link, it might be useful to you.

    Extending and Embedding python interpreter

    Python/C API

    :) Good Luck

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
    The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now