Getting Started With REPL on Raspberry Pi Pico Using Rshell
by mahmoodmustafashilleh in Circuits > Raspberry Pi
1086 Views, 3 Favorites, 0 Comments
Getting Started With REPL on Raspberry Pi Pico Using Rshell
In the ever-expanding realm of embedded systems and microcontrollers, the Raspberry Pi Pico W has carved a niche for itself as a versatile and affordable option for DIY projects, learning, and prototyping. Its compact size, powerful capabilities, and extensive community support make it an ideal choice for both beginners and experienced tinkerers. However, working with microcontrollers often involves a fair share of challenges, especially when it comes to managing files, deploying code, and interacting with the device. This is where rshell comes to the rescue.
rshell, a remote MicroPython shell tool, empowers developers to effortlessly communicate with their microcontrollers, manage files, and execute commands as if they were working directly on the device. Whether you're a hobbyist wanting to upload scripts without the hassle of physically connecting to your Raspberry Pi Pico W, or a professional seeking an efficient way to deploy firmware, rshell can significantly streamline your workflow.
In this blog post, we'll embark on a journey to discover the capabilities of rshell and learn how it can be seamlessly integrated with the Raspberry Pi Pico W. We'll explore its installation, set-up, and walk through practical examples of managing files and running scripts. By the end, you'll have a valuable addition to your toolkit that will not only save you time but also broaden the horizons of what you can achieve with your Raspberry Pi Pico W.
So, buckle up and get ready to uncover the world of remote microcontroller management with rshell. Whether you're working on robotics, home automation, or simply enhancing your programming skills, the insights shared in this blog will undoubtedly empower you to make the most out of your Raspberry Pi Pico W projects.
Before reading the remainder, be sure to subscribe and support the channel if you have not!
Subscribe:
Support:
https://www.buymeacoffee.com/mmshilleh
Prerequisites:
- Python 3 on your computer
- Raspberry Pi Pico or Pico W
- MicroPython installed on your Raspberry Pi Pico W
Supplies
Raspberry Pi Pico W
Pip Install Rshell
- Since rshell is a Python package we can simply run -> pip install rshell, in the terminal or cmd of your computer
Enter Rshell
Entering rshell is very easy after you have it installed, ensure your Raspberry Pi Pico W is plugged in. Simply type the command rshell in your terminal to enter the environment.
There are many commands you can run in rshell on the Pico, type in help, to see what commands you have available. We will be using a command to allow us to write live code to prototype quickly on the device in MicroPython.
To run live interactive code on your device, type the command repl, you will see three right arrows “>>>” pop up, meaning you can start scripting. We will write a simple program to blink the LED on the Pico W. Type in the following line by line:
from machine import Pin
led = Pin("LED", Pin.OUT)
led.toggle()
Running this should turn off/on your LED which is confirmation that this works! Pretty cool.
Conclusion:
For more on how to use REPL please watch the Youtube video above where I go over how to move files onto the device. Overall REPL can be convenient for quick prototyping and some people may prefer coding in such an environment, believe it or not. Hope you learned something new and simple. I surely did.