Live data from Hacker News

MicroPython

micropython.org

141–150 of 152 posts

Re: MicroPython

#141
post #126

Earlier quoted context omitted.

The biggest thing you are underselling (if at all), is that you can have a repl directly into the device itself and doing lots of exploratory programming directly in-circuit.

PEEK POKE (who named these interesting commands?)

Via https://en.wikipedia.org/wiki/PEEK_and_POKE:

> One of the earliest references to these commands in BASIC, if not the earliest, is in Altair BASIC[4].

[4] https://archive.org/stream/bitsavers_mitsMITSAl_6669937/MITS...

So, it seems to date back to 1975.

Re: MicroPython

#142
post #25

Earlier quoted context omitted.

Why would you want to replace Lua in this space? At least why replace with another dynamically typed, imperative scripting language, but without tail-call optimization? What would be the gain?

I was wondering the same as the parent, and in my case it's library support (e.g. NumPy) and compatibility/familiarity in the space (VFX) where Python is everywhere and Lua is unheard of.

So, use Python instead of MicroPython.

Re: MicroPython

#144

Earlier quoted context omitted.

> Why would you want to replace Lua in this space? The crowd of people who speak Lua is pretty different than those who speak Python. I would guess the Lua crowd to be older, more experienced, but smaller. The Python crowd is much bigger, and includes people who dabble in coding rather than those of us who do it for a living. It depends on the user base of your application, but I can totally see why Python would be a…

The Lua crowd includes kids learning to code because they want mods in Minecraft and other games. Sometimes I see Lua suggested a a first language over JavaScript because it's much smaller and has less warts (plenty of warts exist though). Can you even use V8/SpiderMonkey in the same way as LuaJIT?

You mean Minetest, right? Minecraft doesn't have native modding support, let alone Lua modding support.

Re: MicroPython

#145

Earlier quoted context omitted.

The Lua crowd includes kids learning to code because they want mods in Minecraft and other games. Sometimes I see Lua suggested a a first language over JavaScript because it's much smaller and has less warts (plenty of warts exist though). Can you even use V8/SpiderMonkey in the same way as LuaJIT?

You mean Minetest, right? Minecraft doesn't have native modding support, let alone Lua modding support.

Various, including some very popular, mods for Minecraft include Lua. I assume that's what they are referring to.

Re: MicroPython

#146
post #54

Earlier quoted context omitted.

Do you think it's suitable as a game scripting language? How hard is to write bindings for micropython? I've looked into cython but I'm not sure it's what I really need.

It is not too difficult, just extremely verbose (even for a simple int arg function): https://docs.micropython.org/en/latest/develop/cmodules.html This might help: https://github.com/stinos/micropython-wrap

thanks, this is nice but building it seems complex. FFI seems more suitable.

EDIT: actually neither FFI or this wrapper you linked are what I need. I need to execute micropython from C++, not the other way around.

Re: MicroPython

#147
post #137

Earlier quoted context omitted.

I haven’t looked at the latest advancements with MicroPython, but last I checked it was both slow and unsafe in ways I wasn’t used to, such as certain language features not being allowed in interrupt handlers, certain operations being interruptible, etc. I totally hear what you are saying about building stuff for less technical people to hack on, but as someone comfortable with C ( gasp! shock! ), I prefer the predic…

Not really following the logic wrt predictability. I mean, you run it on a microcontroller so yes things can be interrupted. Just like in C. And while allocation not being allowed in an interrupt handler can be annoying, it's also predictable once you know it. And no matter what language you use, you don't go wild in an interrupt handler on a microcontroller anyway.

IIRC things like accessing or assigning dict values were not atomic and could be interrupted. Sure you could code up the same kind of pattern in C but you could also code up a lot of patterns that don’t have this problem.

Re: MicroPython

#149
post #81

Earlier quoted context omitted.

There's a real advantage to having an interpreter. Write your low-level/high performance code in whatever. Then write top-level logic-- and let your users script in-- micropython. I'm teaching a middle school class this year with micropython on embedded. I can't fit Rust in with everything else I'm teaching in one trimester. I've even written an IDE which runs in the browser (on chromebook, etc) so there's no externa…

Which boards are you using and how did you chose them?

I designed a little board that shims under a standard ESP32 module and has capacitive touch, a couple channels of motor driving, MEMs gyros, and LEDs. I was able to get things to $5/unit at qty 50 (counting ESP32) this way and to get exactly what I needed.

My brother taught a robotics team where he used https://www.adafruit.com/product/3333 and was really happy with it... but I wanted something a little beefier and to have wireless options.

Re: MicroPython

#150
I've been doing microprocessor stuff since the basic stamp 2 came out. (not that I'm an expert, I've just been fiddling over a long amount of time)

I know that previous me was very scornful of micropython (the original boards were pretty expensive and power hungry)

However, the ESP* and SAM21 microprocessors have changed my opinion. Yes python is still wasteful. but I can now operate in the microamps, and for less than £7

Not only that, these micro controllers has a wealth of documentation and addons.

I feel like I've discovered the arduino all over again.

Post reply on HN