English video (https://www.youtube.com/watch?v=5Tu4BAkZTjE):
Portuguese video (https://www.youtube.com/watch?v=oUEj2obLdco):
They arrived, and they work on BIPES “as they are”. Just connect pyboard to the USB port and use it with BIPES!
Console, just after connecting:
First test program:
Test program running:
BIPES File manager (fully web based, with upload, download, edit, run and delete options over USB/Serial, replacing ampy):
Soon: custom blocks for the pyboard and pyboard option!
When we love what we do and have no responsibility with our own money 😦
Boards purchased for research / experiments:
2 pyboards from MicroPython Store (They are great, by the way)
Total = 64.75 GBP
Shipping: 45 GBP
Total order with shipping: 109.75 GBP (=149.56 USD or =809.91 BRL [R$])
Taxes: 850 BRL – more than the value of the products plus the shipping!
Total: R$ 1659 (BRL) for 2 pyboards!
R$ 1659 would buy:
(*) GBP/Dollar conversion on 19-08-2021
And the R&D investment compared to the judiciary system on several countries:
Nostalgia: My TK 3000 iie Compact, a brazilian microcomputer, still works nicely!
It is an Apple II clone with 65C02 CPU, 128Kb of RAM and green screen! From 1987!
Damien George, the creator of MicroPython talking about the project history and MicroPython usage on satellites!! Good option for Brazilian Satellite Olympiad projects. Kits include ESP32 SoCs, which can run MicroPython…
MicroPython: a journey from Kickstarter to Space:
How MicroPython went into Space:
There’s a long time I’ve been interested on some interpreter similar to Python that could run on low end Arduino boards, such as Arduino Nano, Uno or Mega. I have tried “python-on-a-chip” (https://code.google.com/archive/p/python-on-a-chip/) / PyMite (https://github.com/dwhall/p14p) and TinyPy (https://github.com/philhassey/tinypy). Some of these projects are quite old and none of them had the characteristics I wanted. Moreover, seems that they are not maintained anymore. I also tested Arduino-PyMite (https://github.com/netpipe/Arduino-Pymite), a version of PyMite that can be easily built and loaded on Arduino using Arduino IDE, but it is also not what I wanted.
But today I found a recent project by accident: Snek: A Python-inspired Language for Embedded Devices (https://sneklang.org/). Created by Keith Packard, at the end of 2019, snek has a syntax similar to Python and implements a subset of Python language. I got impressed on how the tools are well organized and structured and about the robustness of the language running tests on an Arduino Mega and an Arduino Uno (https://keithp.com/blogs/snek-duino/).
But what I loved most, is the interactive REPL over serial port using standard terminals. Just flash snek on an Arduino, open your terminal and “talk” to the board as you would on a Python REPL prompt. This is so much clean and practical!
Another great work of Keith was to provide tools to easily install / flash snek on Arduinos and other boards. There are also Ubuntu packages for snek, and even a PC interpreter to play with snek on a desktop computer.
In my case, I downloaded and installed the Linux version with these commands:
$ wget https://sneklang.org/dist/snek-linux-1.5.sh $ chmod +x snek-linux-1.5.sh $ ./snek-linux-1.5.sh
I installed snek on ~/Snek. After that, we can use tools to easily flash snek on our Arduinos! For example, to flash snek on an Arduino Mega, simply run:
$ cd Snek $ ./snek-mega-install
Done! Now we can already access snek prompt with any serial terminal. In my case, I tried with minicom:
minicom -b 38400 -D /dev/ttyACM0
Note that some snek versions are configured to 115200 bps and other, as I have seen on the source code are configured for 38400. The package mentioned above are set to 38400 for Arduino Mega and Uno. Anyway, I could then easily use the REPL to control a LED and read the Arduino’s ADC:
Blinking the LED on D13 pin:
> talkto(D13) > while True: + on() + time.sleep(1) + off() + time.sleep(1)
Reading the ADC:
Snek input values range from 0 to 1 on the ADC, so 1 means 5V for the standard ADC and 0 means 0V. If we multiply the reading by 5.0, we will have the ADC reading in volts. Quick and easy!
> while True: + print(read(A0)*5.0) + time.sleep(0.8)
Detailed documentation and functions:
Snek’s author/creator presenting it:
Snek has also an editor written in Python, called snekde, but I am happy with the simple serial console. One interesting possibility is to create a web page using avrbro (https://github.com/kaelhem/avrbro) and Web Serial, allowing new users to flash snek on Arduinos directly from a standard web page!
Finally, I decided to implement some snek functions as BIPES blocks! Yes! BIPES meets Arduino thanks to Snek! And it worked nicely! Now we can use BIPES to program Arduino with Snek using blocks!
Here is a complete BIPS program, with 3 functions, generating and running code for Snek!
And a simpler example running:
My thanks and congratulations to Keith Packard for this great project! I also thank Jorge Marques (https://github.com/JorgeGMarques | https://www.linkedin.com/in/gastmaier/ ) very much for the refactoring he has made on BIPES code, making it easier to add Arduino / Snek target boards with specific parameters, such as serial speed and buffer size configured at BIPES devinfo.json (https://github.com/rafaelaroca/BIPES_ui_testing).