I want to send string from pc to Pico to turn-on and turn-off the led built in, I'm using UART but I'm not having success in that.
To send the string I use two different options: a program called VVVV (that I use for my project) and Window's CMD (echo 'hello' > COM n); in both cases programs send messages (I verify using serial port monitor), but Rasperry Pico doesn't receive nothing! Or rather: the sent strings are displayed in Thonny's shell, but it is as if nothing happens.
Instead, Pico is able to send messages to VVVV or pc in general (verified using PuTTY).
This is the code I wrote, nominated 'main.py':
Code: Select all
from machine import Pin, UART from utime import sleep led = Pin(25, Pin.OUT) vvvv = UART(0, 9600) while True: data = vvvv.readline() num_char = vvvv.any() string = str(data) if (num_char > 0) is True: led.toggle() sleep(2) sleep(0.5)