Connect Pico MicroUSB, main.py in Pico will run. Upload a main.py to Pico and release the COM serial (usually COM3, you can also use PC python to query). Look this page to give you a solution( ). You can use Pico's dual core, create a thread to listen the COM. Similarly, this tutorial walks you through doing it in a background-thread. There is a thread over on the raspberry pi forms where functional 2-way serial code is shown. u2f file or use a separate debugger (such as a pi or a second pico as a picoprobe) using one of the UART peripherals then you could use the USB port as a serial connection. It just will not work with Thonny since Thonny has taken over the serial port. This is far and away the easiest solution and also gives you access to any function within microPython which may be useful for debugging as you can just print whatever value you want.Ĭode code above isn't wrong. So you could write a program such as this: from machine import pin This allows you to call functions directly on the pico. You can read a little more about it here. When a program isn't running on the pico, however, you have access to REPL. You cannot directly write to the serial port from your computer when a program is running. In Thonny (and micropython) this is dedicated to loading code. There cannot be more than 2 devices on a given serial port. Serial communication is purely bi-directional. I've tried many methods from both serial or stdlib libraries without any result.Īlso important thing - for PC side of script I'm using P圜harm, for Raspberry side - Thonny.Īfter flashing Raspberry Pico, I'm disconnecting the serial and starting to run the script in P圜harm, with different interpreter. Is there any way to use the sequence debugger in Thonny IDE? The point is, that I'm unable to send anything from my PC to raspberry nor the way back.ĭoesn't affect the LEDs on breadboard, nor the messages get printed in terminal.Īnd here's the piece of code on Raspberry Pi Pico: import timeĪlso - what's the smartest way to debug the code onboard the Raspberry Pi Pico?Īfter acquiring the serial connection, standard print debug? I'm trying to achieve 2-way comms over USB (COM port) between Raspberry Pi Pico and Windows PC (Python).
0 Comments
Leave a Reply. |