Introduction: Intel Edison Running Python Script
In this instructable I will teach you how to connect to your Intel Edison board by SSH and how to create and run a basic Python script. So lets begin!
Step 1: Required Components
- You need a computer running Windows 7 or 8. Other versions of windows may be compatible too, I just didn't test them.
- Intel Edison with Arduino breakout board
- Two USB micro-B cable
- SSH client such as PuTTY (putty.org)
- Python for windows <--- Optional, just to test your scripts
Step 2: Connections and Serial Ports
Connect both USB cables to your computer and your board, one is used for power and the other one provides to connect to the Linux side of your Intel Edison.
Go to device manager and check "Ports (COM & LTP)".
You will see two ports for the Intel Galileo as showed in the images. In my case are USB Serial Port (COM5) and Intel Edison Virtual Com Port (COM6). Focus on the USB Serial Port, that in my case is COM5.
Step 3: SSH Client
In this case we will use PuTTY as SSH client. To install it just:
- Go to this web page: putty.org
- Navigate to the download section
- And click on putty.exe
- Save the file in any location
To run PuTTY:
- Just double click on the file putty.exe
- If it opens you a security alert, click "run"
To connect to your Intel Edison Board:
- Now on PuTTY screen select "Serial"
- In "Serial line" write your serial port, in my case was COM5
- In "Speed" write 115200
- Press "Open" and a new window will appear
- Press "Enter" twice
- A welcome screen will appear and will promp you for a login
Step 4: Linux
Now it is time to play.
Login to your board by typing "root" as username and just hit "Enter" on password.
You can try Linux commands such as:
- "ls" to list the directory content.
- "cd" "name of a folder" to open that folder
- "cd .." To return to previous folder
Step 5: Python
Now we can open Python interpreter and play with basic functions.
On console type python and python interpreter will open.
Now we can try python print function by typing print "hello world!"
A "hello world!" text will appear.
To exit python interpreter write exit() and press "Enter"
Step 6: Creating and Running a Python Script
A Python script is a file that contains one or more lines of code so we can just run this file to execute our program.
To create a new script we will use a basic editor called "vi". Follow the next steps:
- In terminal type vi myscript.py and hit enter.
- vi opens, to start writing type i to activate insert mode
- Write your Python code (See images)
- To stop editing press "Esc" key
- Write :wq to write file and quit
To run your script:
- Just type python myscript.py