4 ms·
It's really quite nice to be able to telnet into a running micro-controller (over wifi even!), play around with pins directly, all that. Being able to run code
by traverseda 4y ago
It's really quite nice to be able to telnet into a running micro-controller (over wifi even!), play around with pins directly, all that.
Being able to run code at runtime with no compile step also opens up the possibility of micro-controllers that can load "apps" or other user code at run time.
Somehow I don't think people would be this snobby about the advantages of an interpreted language if it was running lisp^1 instead of python. Of course to be fair if it was javascript they'd be twice as snobby and I'd agree with them...
[1]: https://thenewstack.io/nasa-programmer-remembers-debugging-lisp-in-deep-space/ https://thenewstack.io/nasa-programmer-remembers-debugging-l...
- the__alchemist 4y agoIt's not about being snobby - it's about choosing the right tool for the job. Challenge: Come up with a set of project requirements for a practical electronics device, and evaluate if Python is the right tool for the job. I'm suspicious you'll run into headaches with interrupts, DMA, concurrent processes interfering with each other due to taking up too much CPU time, onboard peripherals beyond the most popular in the most popular configs won't work etc.
- traverseda 4y agoA user-interface for 3D printers. * Must be able to communicate with arbitrary 3D printers over USB, should be able to act as a USB host. * Must be able to load user programs/extensions. * Must be able to connect to wifi and host a rudimentary web interface. * Must have a color display and user interface including graphs. * Must have a BoM cost of less than 40 US dollars. --- I'd argue micropython would be the best choice for that set of requirements, as opposed to something like a raspberry pi. Not sure you can get an RPI with a display in that price range, but you can definitely get microcontrollers that support USB host and have a screen in that price range, in bulk and able to be incorporated into an actual product. For the user plugin loader, you might be better off using a lua interpreter? I think micropython would still be a good choice for it though. Any thoughts on how you'd want to put something like that together?
- hecanjog 4y agoHaving just used it to interactively play around with PWM settings controlling some motors and solenoids for a music project, I found it much more useful than compiling a new firmware and flashing the microcontroller for every tweak I'm making. I don't have a very compelling reason to port it to anything else at this point, for doing control-rate (in other words: slow) updates to PWM outputs on a microcontroller, it works perfectly.
- chasd00 4y agoYes, being able to fiddle with peripherals right there on the repl skipping the compile and flash step is a huge productivity gain.
- nkrebs13 4y agoIf you're doing any serious amount of work in any situation then I agree with you, but sometimes the best tool for the job is the one that gets the job done. CircuitPython is special-built for this exact task -- to make microcontroller work more approachable and accessible for beginners and/or projects with a small scope. Anecdote: I used it a few weeks ago for a project that was small and had a tight timeline. As a beginner to electrical engineering with microcontrollers it was nice to not have to struggle through language syntax as well. This solved my use case perfectly.
- jvanderbot 4y agoWe're getting lost in the weeds a bit. All the examples and "fast prototyping" mentioned in these threads are possible because someone wrote _C_ code to handle the 80% of common use cases then wrote python bindings to make it easier to write. It's not really the Python that makes the difference, it's the fact that all the common peripherals and happy paths are pre-written for your board/mcu. My impression about modern embedded devices is that it's much less about bit-banging together 14 barely-compatible components with high timing requirements than it is just getting a battery-powered, wifi-connected, USB-compatible handful of COTS sensors online and dumping to your dashboard. Circuit Python seems totally reasonable for that.
- skybrian 4y agoYes, and using C++ based systems like Arduino and PlatformIO seems similar. Those of us who use them are hoping not to have to write our own device drivers, though it's certainly possible when needed. These software platforms are sort of like little operating systems - from a practical standpoint a lot of the value comes from the hardware support. How useful it is depends on whether there is support for the boards and devices you want to use.
- arwhatever 4y agoRequirement: when someone opens your front door, closing the contacts of a magnetic reed switch, send a (hard-coded) http message to a serverless function.
- tlavoie 4y agoHow about https://ulisp.com/ https://ulisp.com/? It's a subset of common lisp, and seems to be able to do a fair bit. The Python interpreters probably have a lot more community traction though.