Then there are two appraoches:
The first/only way Ciro could find was with ampy: stackoverflow.com/questions/74150782/how-to-run-a-micropython-host-script-file-on-the-raspbery-pi-pico-from-the-host/74150783#74150783 That just worked and it worked perfectly!
pipx install adafruit-ampy
ampy --port /dev/ttyACM0 run blink.py
TODO: possible with rshell?
Install on Ubuntu 22.04:
python3 -m pip install --user adafruit-ampy
Ctrl + X. Documented by running help repl from the main shell.
Some generic Micropython examples most of which work on this board can be found at: Section "MicroPython example".
Pico W specific examples are under: rpi-pico-w/upython.
The examples can be run as described at Program Raspberry Pi Pico W with MicroPython.
Blink on-board LED. Note that they broke the LED hello world compatibility from non-W to W for God's sake!!!
The MicroPython code needs to be changed from the Raspberry Pi Pico 1, forums.raspberrypi.com/viewtopic.php?p=2016234#p2016234 comments:
Unlike the original Raspberry Pi Pico, the on-board LED on Pico W is not connected to a pin on RP2040, but instead to a GPIO pin on the wireless chip.
Any print() command ends up on the USB, and is shown on the computer via programs such as ampy get back.
However, you can also send data over actual UART.
We connect Pin 0 (TX), Pin 1 (RX) and Pin 2 (GND) to the DSD TECH, and the USB to the Ubuntu 25.04 host laptop.
Then on the host laptop I run:
screen /dev/ttyUSB0 9600
and a counter shows up there just fine!
The program continuously prints to the USB the value of the ADC on GPIO 26 once every 0.2 seconds.
The onboard LED is blinked as a heartbeat.
The hello world is with a potentiometer: extremes on GND and VCC pins of the Pi, and middle output on pin GIO26, then as you turn the knob, the uart value goes from about 0 to about 64k.
The 0 side is quite noisy and varies between 0 and 300 for some reason.
In Ciro's ASCII art circuit diagram notation:
RPI_PICO_W__gnd__gpio26Adc__3.3V@36
            |    |          |
            |    |          |
            |  +-+          |
            |  |            |
            |  |  +---------+ 
            |  |  |
         P__1__2__3
This example attempts to keep temperature to a fixed point by turning on a fan when a thermistor gets too hot.
You can test it easily if you are not in a place that is too hot by holding the thermistor with your finger to turn on the fan.
You can use a simple LED to represent the fan if you don't have one handy.
In Ciro's ASCII art circuit diagram notation:
            +----------FAN-----------+
            |                        |
            |                        |
RPI_PICO_W__gnd__gpio26Adc__3.3V@36__gpio2
            |    |          |
            |    |          |
            |    |          |
            |    +-THERMISTOR
            |    |
            |    |
            R_10-+

Articles by others on the same topic (0)

There are currently no matching articles.