Shop OBEX P1 Docs P2 Docs Learn Events
Python-based MicroController — Parallax Forums

Python-based MicroController

GadgetmanGadgetman Posts: 2,436
edited 2013-12-11 14:21 in General Discussion
Found this strange little beastie on Kickstarter, and figured that it might be interesting for some...

http://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers

The board is Cortex M4-based, has uSD slot, 3-axis accelerometer, 4 servo ports...

Interestingly, the stretch goals aren't more HW, but SW libraries. So far he's been adding Wireless and cabled network ( CC3000 and WIZ820io modules), and the next is 'Low power Wireless' using the NRF24L01+ module.
(Actually, they've just passed the £60.000 for that goal, too)

I'm in for the £24 level.

Comments

  • Heater.Heater. Posts: 21,230
    edited 2013-12-07 03:33
    Gadgetman,

    Micro Python sounds like something I have to get hold of.

    Have you also seen the Espruino on kickstarter? http://www.kickstarter.com/projects/gfw/espruino-javascript-for-things

    Despite it's name Espruino has nothing in common at all with Arduino. It's a similar concept to Micro Python except it's JavaScript on an ARM micro-controller.

    Both these guys come from Cambridge in England but they did not know of each other until recently.

    They had both written their interpreters as closed source.

    They both designed little boards to run their creations.

    They both started their kickstarters on the promise of open sourcing their software and writing new features as much as providing the boards.

    I put money into the Espruino mostly to get the software opened up, which it now is. I have been running it on an STM32F4 Discovery board, it's great.

    I suspect one day we will see Micro Python and Esprunio JavaScript running on the Propeller II. How cool is that ?

    P.S. Here is a great video of Gordon Williams demonstrating what the Epruino can do http://www.youtube.com/watch?feature=player_embedded&v=lrJJQ1uW3lA
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-12-07 04:26
    I wasn't aware of the Espruino...

    May buy one later...
    (Not that I care for JavaScript... )
  • Martin_HMartin_H Posts: 4,051
    edited 2013-12-07 04:28
    This is probably a good idea as Python is a decent language. I expected to hate the syntactically meaningful white space, but didn't. I've done a few smaller projects in it and I would group it in the "no surprises" languages family. Basically as you use it, it tends to keep working as you expect, and provides most of the tools a modern computer language should (e. g. classes, inheritance, encapsulation). The obvious exception is its lack of a case statement and interfaces. The former is just plain weird, the latter is because of duck typing which is common to all the dynamic languages.
  • Heater.Heater. Posts: 21,230
    edited 2013-12-07 05:11
    Python is a wonderful thing. The white space thing is brain damaged but I can forgive it for it's "no surprises" and other powerful and useful features.

    Damian George seems to have done some serious magic there, enabling Python to be compiled to byte code or native machine code and having a built in assembler!

    What I'm wondering is how it handles many things going on at the same time. JavaScript is event driven which is perfectly suited to this but Python generally is not.

    Aside:

    I keep hearing complaints about the lack of "interfaces" in languages recently. What is the deal with that? If your code gets hold of an object that does not implement an expected method (the interface) it is going to crash and burn at run time like many other error you can make in dynamic languages. So what? You fix it, like all those other mistakes.

    C++ does not have interfaces. You can fake it with inheritance (or sing lambdas now a days) no body seems to worry about that.
  • Martin_HMartin_H Posts: 4,051
    edited 2013-12-07 06:18
    Heater. wrote: »
    What I'm wondering is how it handles many things going on at the same time. JavaScript is event driven which is perfectly suited to this but Python generally is not.

    Aside:

    I keep hearing complaints about the lack of "interfaces" in languages recently. What is the deal with that? If your code gets hold of an object that does not implement an expected method (the interface) it is going to crash and burn at run time like many other error you can make in dynamic languages. So what? You fix it, like all those other mistakes.

    C++ does not have interfaces. You can fake it with inheritance (or sing lambdas now a days) no body seems to worry about that.

    Python has multiple threads which are a more general mechanism than event handling.

    An interface is a contract enforced at compile time that an object will support a set of methods. This ensures that your program won't crash at runtime and follows the "no surprises" philosophy. It allows for the dependancy injection or filter chain patterns which are used a lot in modern programs.

    C++ supports abstract classes with multiple inheritance which is a more general form of interface based programming. The problem with C++ is that you can do too much of a good thing.
  • Heater.Heater. Posts: 21,230
    edited 2013-12-07 07:05
    My understanding of threads is that they need more resources, not good in a confined space. They increase overheads of context switching and introduce problems of race conditions. All of which is neatly circumvented by the evented model, which of course brings issues of it's own.

    Compile time checks, for example interface contracts, don't mean much with systems like Python where compile and run time are intertwined.

    Making interfaces with inheritance always irked me. I want to say that A and B have the same interface whilst not having logically in common. inheritance always seems to mean more than that to me. Inheritance is saying that A and B are a kind of I (the interface) which may not be what I want to say.

    You can enforce interface contracts in C++ using lambdas and no inheritance. In which case A and B are not any kind of I. Problem is you then can't store A and B in common stores.

    Yep, C++ can sure do too much of a good thing!
  • jazzedjazzed Posts: 11,803
    edited 2013-12-07 08:34
    My observations on Python:

    I.E. my personal likes, dislikes, and undecideds - without trying to start a language war.

    Like:

    - List comprehension is an interesting one-line short cut replacement for a for/while loop.
    - Sets and dictionaries hashtable-like O(1) performance.
    - Good built-in data-structure and algorithm equivalents: list, tuple, set, dictionary.
    - Syntax for tertiary is nice. I.E. x = 0 if y < 3 else x += 1
    - Command dir(object) is nice to have while exploring a class, but can't replace simple docs.

    Dislike:

    - The interactive ability of Python doesn't offer any real value.
    - I despise ending def, if, while, etc... with a colon ":"
    - Version 3.x is not very well supported yet.
    - The language syntax needs to stop changing for me to take it more seriously.
    - Contrived syntax: No constant variables. No real private methods or variables.
    - No compile-time syntax checking makes me crazy.

    Not sure yet:

    - Having N digit integers is interesting, but seems only practical for doing scaled floating point.
    - Syntax is UML friendly, but I'm not sure that's really of any value.
    - The for syntax only applies to lists for n in list: or for n in range(0,100):
    - If you really want "case" functionality, you can design it with exceptions.
  • KC_RobKC_Rob Posts: 465
    edited 2013-12-07 09:32
    Martin_H wrote: »
    This is probably a good idea as Python is a decent language.
    It's becoming very popular in education too.

    By the way, there is also PyMite, which has been around for while. It runs, for example, on PIC32 (and others).
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-12-07 11:28
    Makes you wonder what's the next language to show up on a SBC of this size, though...

    Maybe Interactive Pascal makes a return?

    Personally, I'm hoping that REXX will be implemented on one soon...
    (It started on mainframes, and has been ported to all sizes down to the Palm Pilot, and back up again, and is even considered a precursor to Python, so why not?)
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-12-11 14:21
    Imagine if handling a servo w that easy on a Stamp...

    http://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers/posts/690857

    It may be able to handle two or more servos at the same time, too. Or the designer may have misunderstood my question...
Sign In or Register to comment.