Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Hello World With Python

In this lesson, you’ll recreate the “Hello, World!” sketch using Python.

For more information about pyFirmata and other languages that work with Arduino, check out the following resources:

nitishnit2016 on April 18, 2020

sir can you explain the process to install python 2.7.9 in windows and how to add pyfirmata lib in it

erniej55 on May 24, 2020

I am unable to import pyfirmta and import time and anything beyond the pip install of pyfirmata. I am using python 3.7. I attempted to create the sketch in terminal but getting no module found errors for pyfirmata

Chris Bailey RP Team on May 25, 2020

Hi @erniej55, I’m a little confused by your question. You say that you have Python 3.7. What computer platform are you one, and what Operating System?

You mention that you are unable import time, that one is strange as it is a built in module, and you should normally be able to import it without any additional installation.

You note that you are creating the sketch in the terminal. I don’t understand this. What are you using to write the Python script? Is it a text editor, or IDE, or tool like Thonny?

You can test your that your installation of pyfirmata worked properly in your terminal, by starting a Python REPL session and attempting this:

import pyfirmata

Are you using Thonny? It would require different steps to install the package, using Thonny’s built in package manager.

Sorry if I’m leaving with more questions than answers, but I want to make sure I can give more directed advice and help.

erniej55 on May 29, 2020

Thanks for responding, I am using Macos Catalina and Jupyter Notebook with Python 3.7. I am new to this, my issue was the path to my board for this exercise. Once I got that corrected I was able to get thru the Hello World with Python.

R-4360 on Aug. 15, 2020

I am lost at the point where you install pyfirmata

R-4360 on Aug. 17, 2020

Have installed Firmata How and where do I install $ Python -m pip install pipfirmata ?? Your instructions are easy to follow except at Point 3:40 minutes.

Chris Bailey RP Team on Aug. 17, 2020

Hi @R-4360,

To install pyfirmata, you should be able to use pip. Things may be a little different depending on your Operating system. The best command to use if you are on a Python 3.6 or higher installation would be:

python3 -m pip install pyfirmata

You need to be in a terminal, I’m using VSCode in my tutorial. To open a terminal window in VSCode I use the key command of holding the control key and pressing the tilde key (~).

If that doesn’t work, can you tell me a bit more about your setup? What computer, Operating System, Python version, and editor are you using?

R-4360 on Aug. 19, 2020

I am 99% electronic/computer hardware person, so loading of software other than user apps can sometimes be a problem. Where do I find VSCode terminal and hove do I install it? Only terminal I know is CMD on windows. I am using Windows 7, as the Arduino IDE gets installed with unrecognizable letters, changing the language has no effect. I have tried multiple versions of the IDE and they all act the same way. My computer spec are as follows: Windows 10\7 Dual boot, AMD FX 9590 Processor, 16GB Memory, 500GB SSD, 3TB Data storage.

Chris Bailey RP Team on Aug. 19, 2020

Hi @R-4360, Microsoft Visual Studio Code (VSCode) is a free Integrated Development Environment (IDE). You can install it from this website.

Here is a link to another video course on setting it up. And this is a link to the article that course is based on.

How are you currently writing Python scripts (what editor)? What version of Python is installed on your machine?

I’m not sure I understand your comment about:

“Arduino IDE gets installed with unrecognizable letters”.

Were you unable to install the Arduino IDE? Can you run the example “sketch” from the previous lesson? You will need to send the firmata sketch to the board before you can try to talk to the board using Python.

Maybe the Forums could be a quicker way to get solutions as this is such a slow way to get support for anything beyond a simple question.

R-4360 on Aug. 19, 2020

Regarding “Arduino IDE gets installed with unrecognizable letters” Just under the Arduino 1.8.13 is a line of unrecognizable Characters. It should say “File Edit Sketch Tools Help” Selecting any of the items produces more unrecognizable Characters. This only happens on Windows 10, windows 7 works fine.

Become a Member to join the conversation.