Lily∞Bot With Raspberry PI Pico W: Get Started Programming With MicroPython in Platform IO Visual Basic

by carlottaberry in Circuits > Robots

426 Views, 0 Favorites, 0 Comments

Lily∞Bot With Raspberry PI Pico W: Get Started Programming With MicroPython in Platform IO Visual Basic

RPILily1.jpg

This story is a continuation of the Open-Source Flower∞Bots journey. In the latest version of the robot, it now has a modular bottom and top so that they can be changed as needed for the various brains, microcontrollers or microcomputers and also the necessary power for them. Modified from the following Shilleh's project and Youtube. This project describes how to get started with the Raspberry Pi Pico W attached to the Lily∞Bot to write programs and control outputs and read sensors to execute actions on the robot.

Supplies

RPILily2.jpg

Lily∞Bot from NoireSTEMinist.com/shop includes Raspberry PI Pico W,

or 3d printer and CAD files and code at https://github.com/berry123/Lily-Bot

Install MicroPython on the Raspberry PI Pico W

raspberry_pi_pico_w_pinout.png
TinyBreadboard.png
LilyPicoWFritzInternalLED_bb.png
  1. Download Visual Studio from this link
  2. Download Python from this link
  3. Download MicroPython from this link
  4. In the link go to Port:rp2
  5. Scroll down and click on the image for Pico W
  6. Click on the latest version of UF2 bootloader
  7. Install MicroPython on the Pico W by plugging the device into your computer while holding down the BOOTSEL button
  8. The folder for the Pico W will open on your computer it will have RP files in there
  9. Drag the .UF2 document that you downloaded from MicroPython into the open PICO W folder
  10. Unplug the PICO W from the computer and plug it back in WITHOUT holding the BOOTSEL button
  11. Open up Visual Studio on your computer and the bottom status should show the PICO connected to the computer
  12. Click on Extensions and do a search on MicroPico and install

Run the Code

  1. Create a folder on your computer for the LilyBot code
  2. Open this folder inside of Visual Studio by using the file explorer button on top left of previous figure
  3. Then click on CTRL-SHIFT-P in Windows or COMMANd-SHIFT-P in Mac or Help->Show All Commands
  4. In the box at the top type MicroPico: Configure Project
  5. Create a Python file (.py) in the folder and copy the code in the following space in the document.
  6. Make sure that there are no errors and confirm that bottom status screen shows the Pico W connected.
  7. Next right click on the file and select "Run current file on Pico"
  8. If the green LED starts blinking, you are all set up and can go on to the next tutorial on blinking and external LED on the Lily∞Bot using Raspberry PI Pico W with MicroPython. If not, please walk through this tutorial again until you can get it working.




#CAB 9.14.23 buzzer.py
#blink internal LED on Raspberry PI Pico W on Lily∞Bot
#LED on pin 25
#https://www.noiresteminist.com/shop


from machine import Pin
from utime import sleep


pin = Pin("LED", Pin.OUT)


print("LED starts flashing...")
while True:
    pin.toggle()
    sleep(1) # sleep 1sec

Downloads

Confirm It Works

Lily∞Bot: Blink internal LED on Raspberry PI Pico W with MicroPython
  1. Watch the video to confirm your robot and code are working correctly.
  2. If it does not, try to debug and troubleshoot your code.
  3. See all Lily∞Bot materials on the GITHUB here.
  4. See all Lily∞Bot videos on the YouTube here. There are several different playlists including hardware, software and control.