Raspberry Pi - Hello World
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .
Additionally, some of these links are for products from our own brand, DIYables .
Detailed Instructions
- Make sure you have Raspbian or any other Raspberry Pi compatible operating system installed on your Pi.
- Make sure your Raspberry Pi is connected to the same local network as your PC.
- Make sure your Raspberry Pi is connected to the internet if you need to install some libraries.
- If this is the first time you use Raspberry Pi, See how to set up the Raspberry Pi
- Connect your PC to the Raspberry Pi via SSH using the built-in SSH client on Linux and macOS or PuTTY on Windows. See to how connect your PC to Raspberry Pi via SSH.
- Create a Python script file hello_world.py and add the following code:
print("Hello World!")
try:
while True:
# Put your main code here
pass
except KeyboardInterrupt:
print("\nExiting the program.")
- Save the file and run the Python script by executing the following command in the terminal:
python3 hello_world.py
- Check the result on the termial.
PuTTY - Raspberry Pi
Hello World!
Modifying Raspberry Pi Code
- Replace “Hello World!” with any text, for example, “Newbiely.com”.
- Then, upload the code to Raspberry Pi.
- Finally, view the result on the Serial Monitor.
PuTTY - Raspberry Pi
Newbiely.com