Pyb library with the RT1062

Hi i am trying to use the pyb library with the RT1062 but i get an ImportError: no module named ‘pyb’

I am trying to make use of the millis() method, may i know how i can do so?

Pyb is an stm32 specific module, you should use time.ticks_ms()

Got it, thank you!

Hi @iabdalkader may i know what library i can use to control the leds for the RT1062?

Just use the LED library under machine.

To control LEDs you can just use machine.Pin, but there’s also a non-official machine.LED that you can also use.

For machine.Pin, it seems like i have to specify an id in the constructor, may i know what id should be used for the RT1062 LED? Also, can the color emitted by the LED be changed?

You can use LED names for both, see the blinky.py example.

LED("LED_BLUE")

Got it thank you!

What if I need “Servo” class? If I recall correctly it needs Pyb module to work; same as for the RCP protocol

Hi, you can just do PWM outputs using the machine module.

Servos just have a PWM frequency of 50 Hz with a pulse length between 1000us to 2000us which controls their motor angle.

Ok, but there is still no way to use RCP protocol

What is is that?

Sorry, it’s RPC protocol.
It should be a way to communicate for server and client systems. If I understood correctly it could allow even to write my own calls (similar to VCP, but via ethernet)

We support an interface library to do this. However, it’s only really robust for uart/spi/i2c/can. It was designed to communicate for systems with low amounts of latency. It doesn’t work so well with PCs which don’t reply quickly.

Given we have a sockets interface on the RT1062 you can roll your own anything for wifi.