Connect with us

Learning electronics with python is good or bad ?

Discussion in 'Microcontrollers, Programming and IoT' started by manoj srinivasan, Mar 17, 2016.

Scroll to continue with content
  1. manoj srinivasan

    manoj srinivasan

    Feb 19, 2016
    I'm a newbie to programming and electronics,I am a IT graduate,I'm basically a networking guy .
    Now i moved to network programming job,where for my job i need to learn python and i am currently learning it.
    I am also interested in electronics ,from the things i had seen in internet it seems like C,ASM,,embedded "C" are popular languages for electronics/electrical related coding.

    I want to learn programming for my job and also want to use the same language(i.e python) for learning electronics.

    my questions

    1)Is my approach good ?

    2)is it possible to learn electronics with python ?

    Need some inputs..
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    I've not seen any embedded systems stuff programable in python.

    Learn python and c++, they're not so different to each other.

    What languages do you already know (none at all?)?
  3. dorke


    Jun 20, 2015
    How does learning Cricket with Field-Hockey sounds to you?
    They do have something in common...
    a ball and something to hit it with;)
  4. manoj srinivasan

    manoj srinivasan

    Feb 19, 2016
    @Steve---> I'm a newbie to programming,as my job states to learn python & i tought it would be better to stick with a single programming language,
    So i just wanted to confirm whether it is possible to learn electronics with python or not .

    @dorke--->ok so whats your point ? it is not possible right ?
    may be i should develop learning 2 languages python and C.
  5. dorke


    Jun 20, 2015

    Yes absolutely!!!
    Python for high level ,and C for "manipulating " Hardware.
    I find C much more difficult for newbies than Python .
    The interface to the Hardware for a programmer is through the "register map" approach(and interrupts) .

    About learning electronics,
    That is a totally different "ball game ".
    You can't learn it with any software.
    There are numerous good books .
    I can recommend "The Art of Electronics" by Horowitz&Hill
    (*steve*) likes this.
  6. Anon_LG


    Jun 24, 2014
    Python is a high level language, it is an abstract language. Python uses higher level concepts, and is more focussed on shortening code, making it potentially easier to learn (I got bored with it quickly though, I only got a quarter through the codacademy course), but when optimisation is needed you can hit a dead end quickly.

    C is a low level language, C++ introduces higher level features, the most notable of which are classes. C is versatile, you have the high level concepts available if needed through the use of C++, but the low level oriented syntax and structure enable access of the hardware.

    High level - higher abstraction, lower complexity. Less code written by user. Lower optimisation if working on a program that approaches the computing limits of the system.
    Low level - lower abstraction, higher complexity. Greater optimisation, the trade off is that more user input is required.

    If you learn python, the simplest solution is use of the Raspberry Pi. You will find that nearly all of the software that is published on the site and the magazine's is centered around Python. And of course, most utilise the GPIO ports, your connection to other external electronic components. As the hype of the Pi has been accompanied by the use of python, python has an easily integratable feature for use with the GPIO's. The only trusted libs that I can find for the Pi with C are wiring Pi and BCM2835.

    But anything other than the Pi, I have not really seen other options for python-electronic interface. C on the other hand goes further. You can get the arduino, compile it and it is sent in machine code to the at328. A uc itself can standalone and have a C program compiled and run on it. So C will give you far more options in terms of electronic usage.

    Beyond that you have assembly, the lowest level human readable language, machine code is like writing in the actual bytes that will be loaded into the flash. Look at the 8008 instruction set and the two are directly translatable as far as I can see, on the avr's it is slightly different and the individual bits of the bytes can be made to do different things dependant upon the instruction.

    Your compiled code can be viewed as a hex file, which can be seen as one step lower than the assembly. This is human readable... If you can memorise the Opcode's! Finally, the compiled code is transfered through a serial protocol to the chip, AVR uses an ISP system.

    That was probably tl;dr and a little opinionated.
    dorke likes this.
  7. NorthGuy


    Mar 24, 2016
    Language is not so important for microcontrollers as it is for "big" computers. This is because there are more important things to learn - like controlling pins, peripheral modules, interrupts, timers. "Big" computers have these things too, but they're isolated from the regular programmer by the OS. By contrast, with microcontrollers these things are all up to you, and without them microcontroller would be useless.

    Some platforms, such as Arduino or MikroE compilers, will provide some higher-level functions to deal with peripheral. Depending on your viewpoint, this may be helpful or restrictive.

    As to the language, many people still use assembler, but I would guess it is too different from Python. So, if you want something more resembling Python, C probably is the best choice. Besides, you may need it with "big" computers too.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day