Live data from Hacker News

MicroPython – Python for Microcontrollers

micropython.org

101–106 of 106 posts

Re: MicroPython – Python for Microcontrollers

#101

I hope we see JS for microcontrollers fast enough so we can enjoy bloated Electron apps running on microcontrollers. :) I mean, who wants anything but the fastest, leanest languages running on microcontrollers?

My Bangle.js smartwatch says hello. Slowly.

Re: MicroPython – Python for Microcontrollers

#102
post #4

Related: MicroPython - https://news.ycombinator.com/item?id=24166861 - Aug 2020 (147 comments) MicroPython and the European Space Agency - https://news.ycombinator.com/item?id=9699798 - June 2015 (28 comments) MicroPython: Python for microcontrollers - https://news.ycombinator.com/item?id=9558969 - May 2015 (19 comments) MicroPython – Python for microcontroller - https://news.ycombinator.com/item?id=8177695 - Aug 201…

> Micro Python - https://news.ycombinator.com/item?id=7839699 - June 2014 (1 comment)

1 comment is not a very big discussion

Re: MicroPython – Python for Microcontrollers

#103
post #26
post #16

A possible alternative to MicroPython is Nim - it's a strongly typed language with Python-like syntax that compiles down to C. Since it compiles to C, it can use existing C libraries without much fuss (just wrap signatures as needed), plus there's no need for a "micro" version of the language. Several members of the community have been working on improving the embedded ecosystem: although I haven't played around with…

I've been using Nim and Nesper for the firmware of a device I'm making, it's been mostly great. Nim's C interop is painless, anything Nesper hasn't already wrapped can generally be pulled in from the official C libraries in one shell command. My only headache with Nim on the ESP32 is that the official framework doesn't provide a full POSIX implementation so some stdlib functions don't work. https://github.com/khogela…

Hey awesome to hear others are using my Nesper! Nice to read through your repo and see what style of Nim coding you used (low level C-like constructs vs higher level Pythonic ones). Feel free to post PR's, I try to merge them once a month.

Re: MicroPython – Python for Microcontrollers

#104

Earlier quoted context omitted.

The MicroPython interpreter is very robust and well tested. We test our devices extensively. You need to pay attention to gc performance, memory use and fragmentation but this isn't our first rodeo! Systems are typically fragile because of poor system design not language choice. I've worked on many C and C++ systems and there's nothing inherently more robust about them. Some would argue that the various ways you can…

> Some would argue that the various ways you can trip over UB makes them more fragile That is definitely a factor! But I probably wouldn't pick C++ for a medical device now anyway - I would go with Ada or Rust. > Systems are typically fragile because of poor system design not language choice. Poor system design and language choice are both factors. You can work around language choice with a shit load of testing, but…

> That is definitely a factor! But I probably wouldn't pick C++ for a medical device now anyway - I would go with Ada or Rust.

I would like to as well, but that is very much not an option in most hardware projects at the time of writing of this comment. The ecosystem for these kinds of projects as a business in hardware is just too young to make it reliable enough to be shipping in a reasonable amount of time. Currently you really have very few choices in mainstream embedded programming for languages in a generic sense. You either work in c or c++, or you use micropython - and even micropython is young enough to invite some skepticism. No other ecosystem rivals these, though I do look forward to some promising commercial embedded Rust projects in the next few years.

Re: MicroPython – Python for Microcontrollers

#105
post #30

I did a lot of product development using Micropython over the past year or so. There are certain things it is very good at - one is rapid prototyping. For instance it’s a lot easier and faster and less verbose to quickly get some http server communication going on the ESP32 in Micropython rather than the C equivalent. The downsides are somewhat dramatic though - it’s, of course, a lot slower and hungrier for memory t…

> It falls apart when you need to work with it professionally though More accurately: it falls apart when you need it professionally :) Totally depends on the usecase.

A fair point, but is it an inaccurate statement to say it falls apart when most need it professionally? I can easily accept that MicroPython makes sense for certain use cases, but to recommend it generally for people when I feel like I wasted many hours down the rabbit hole seems to be a bad idea - and I feel like your comment implies it's something like 50/50. So perhaps it's more accurate to say that there are a few pointed use cases when Micropython makes sense to ship with, but at least 80% (and I feel like I'm being very generous here with that number) of people are going to want to go the c/c++ route at the time of writing this comment in 2022, though I could see that changing in the future.

As an aside, I really like Micropython and I spent a LOT of hours trying to make it work at a production level for my use case, but in the end I relented and had to write my software in C - it's not like I'm some low level language purist here. And it's not like my use case is what I would consider super edgy either - a fairly typical project with ESP32 where you wake sensors up on a very conservative basis (once per hour), take basic readings and send the data over HTTPS.

Re: MicroPython – Python for Microcontrollers

#106
post #4

Related: MicroPython - https://news.ycombinator.com/item?id=24166861 - Aug 2020 (147 comments) MicroPython and the European Space Agency - https://news.ycombinator.com/item?id=9699798 - June 2015 (28 comments) MicroPython: Python for microcontrollers - https://news.ycombinator.com/item?id=9558969 - May 2015 (19 comments) MicroPython – Python for microcontroller - https://news.ycombinator.com/item?id=8177695 - Aug 201…

> Micro Python - https://news.ycombinator.com/item?id=7839699 - June 2014 (1 comment) 1 comment is not a very big discussion

I include 1-comment threads in 'related' lists, especially when they're old, because it can be interesting to see what the 1 comment was from 10 years ago or whenever.

However, you're right about that case because the 1 comment was not that interesting. I'll take it out of the list above. Thanks!

Post reply on HN