The Factory | Coding MicroPython Modules That Work With Both Micro:bit & Raspberry Pi Pico

preview_player
Показать описание
This week dive into some MicroPython and get a PiicoDev module running on both the Raspberry Pi Pico and Micro:bit. MicroPython is a little different between these boards so we'll need to come up with a flexible module that can determine which board it's running on, and adapt to suit.

Core Electronics is located in the heart of Newcastle, Australia. We're powered by makers, for makers. Drop by if you are looking for:

Рекомендации по теме
Комментарии
Автор

Thank you for a really interesting video. I expect there are many on the Raspberry Pi, Pi-Pico, Micro:bit, Python learning curve - where when one is first starting, it often feels as if there are more questions than answers - as one identifies the various jigsaw pieces, where they go, and how they fit together

victorldunn
Автор

Cool, next step is to have them talking to each other and doing multitasking with the devices talking to each other to output a result.

stevetobias
Автор

Given you are trying to wrap the I2C implementations, would it not be a better idea to make a 'wrapper I2C' which handles the concept of which i2c communication system is in use, and then parse that to the temp class, so that it can be reused on other libraries - rather than conflate the i2c wrapping and the temp sensor class together?

With that, you can more easily deal with the situation where the parameters, or initializations for the various i2c busses need further wrapping methods without having to expand what is a simple i2c read/write component for the temperature sensor with the complexity of what i2c bus is available

rdpeake
Автор

If the parameters/arguments are different between functions you'll need to do more interpretation.

For intuitiveness might be worth changing from camel case I2cWrite to a different name, like GeneralI2cWrite. Machines know that case is important, but humans generally have to learn that.

It'll really help others who are not just trying to understand your code, but learn from it.

olivercouch
Автор

only works if parameters are in the same order on the different systems,
machine is already loaded at start on rp2, try "dir(machine)" after boot. (tested in screen and thonny)
why not name the microbit function like the rp2 functions, no need to rename rp2 function then.
(have no microbit so any of these suggestions may fail)
also if microbit has low memory, var=False, try sysname if error import os, get sysname, set var True, del os, import gc, gc.collect() to free up memory, work with var everywhere else. (gc.mem_free() shows memory)

jyvben
Автор

How to receive some data from internal Bluetooth of Raspberry Pi 4 and show it on a GUI ?

adarshkrishnan