This simple project demonstrates a few tricks that can be done with one of the world's cheapest microcontroller, the STM8S003F3P6.
There are three branches of this project:
Just a simple RED/GREEN/BLUE blinky for the first tests.
Communication format is 115200 baud, no parity, one stop bit. Commands start with a command letter, and end with '\n'.
Rxx
Set red led intensity. xx is hexadecimal. 00=off, FF=full on.
Gxx
Set green led intensity. xx is hexadecimal. 00=off, FF=full on.
Bxx
Set blue led intensity. xx is hexadecimal. 00=off, FF=full on.
Pnxxxx
Set PWM for servo control.
n= 0..1.
xxxx= high time in milliseconds. Hexadecimal. 3E8= left position, 5DC= mid position, 7D0=right position.
UUU
Identify. And later may be used for automatic baud rate detection. Please send it first after power on.
V
Get version number.
@xx
Execute test command. Currently known commands:
The same as standard, but R, G, B commands have four digit hexadecimal parameters.