this is for send three differents messages as one string, and separate the strings in micropython, and show the result in the MICROBIT onboard led matrix:
Here is a way of recieve data in the correct way , with the correct serial print format, and the way to separate the incoming data and clean it from the separator (,).
*Hope you can catch the workflow, but more examples are coming, It will have the shape of a library with examples probably, for those who love to control gadgets and do physical computing in gamma and arduino.
*For the very novices, the code in the box is arduino code, which you have to copy and paste in the arduino IDE and compile it, before you can make the gamma patch work.
Send RGB values via serial port for lit a rgb Led , or whatever you need.
This patch it’s very useful, because it shows how to gather all the values we want to send to the Arduino, and make a unique message with separators (commas in this case), so the Arduino code knows what character to use for slice the message in three elements (R, G, B), reassign to variables, so u can do whatever you want with this values in your microcontroller.
It is important to learn how to use the serial port node , even we have the Firmata node because there are many different types of shields, sensors, and other devices that have their own libraries, and use more obscure protocols other that analog/digital read or write.
Additionally, there are many edge sensors and robotics actuators that use UART , ISP or I2C communication.
The good thing about Arduino is that there is a library for almost everything, making it easy to use as a mild form of C++. Knowing how to send and receive data through the serial port allows you to take full advantage of all the libraries and communitty examples .
Additionally, if you plan on working with stepper motors, DC motors with encoders or brushless DC motors, it is recommended to use Phidgets. They are easy to wire and have proven to be precise and safe. Additionally, there is a NuGet package available to use with Phidgets, which eliminates the need to use Arduino or C++ coding for serial communication.
I have here a simple example patch for the ESP32 using SerialPort4 (send and receive).
When you open the patch, you will also see the code for Arduino, which includes explanations.