Download Python for Galileo GEN2

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Python for intel Galileo GEN2
TYWu
Software Download/Setup
• "Bigger" Linux Image
• Download the Arduino IDE for Galileo
– https://communities.intel.com/docs/DOC-22226
Software Download/Setup
• Unzip SDCard.1.0.4.tar
– image-full-galileo folder is generated
Software Download/Setup
• Copy all files/folder under image-full-galileo into
your micro SD card
• Your SD directory structure should look like:
Running "Bigger" Linux Image
(Option 1)
•
•
•
•
•
•
Unplug the USB connector of Galileo
Remove the Galileo power
Plug in the µSD card.
Then power it back up.
Plug in the USB connector
The first boot may take a little longer than
average.
Running "Bigger" Linux Image
(Option 2)
•
•
•
•
•
•
Unplug the USB connector of Galileo
Remove the Galileo power
Plug in the µSD card.
Then power it back up.
Plug in the RS232-USB connector
The first boot may take a little longer than
average.
• You can use the terminal to verify that the bigger
image is working. Try running Python, for
example.
Running "Bigger" Linux Image
• RS232 to USB
– Connect (RS232  Galileo)
• Black Wire  GND
• White Wire  TXO
• Green Wire  RXI
Running "Bigger" Linux Image
• Install Driver
– Download the File
http://www.prolific.com.tw/UserFiles/files/PL2303_Pr
olific_DriverInstaller_v1_10_0_20140925.zip
– Unzip
– Install
Running "Bigger" Linux Image
• Install Tera Term
– http://en.sourceforge.jp/projects/ttssh2/releas
es/
– Download teraterm-4.80.exe
– Execute teraterm-4.80.exe for installation
Running "Bigger" Linux Image
• Open Tera Term
– Select Serial
• Select COMxx:
Prolific …
– SetupSerial Port
• Change Baud rate to
115200
– SetupFont
Running "Bigger" Linux Image
• In the Tera Term
– Entry “Enter”
– Enter “root” as login
name
Python
• The first program helloworld.py
#!/usr/bin/python
# Hello world python program
print "Hello World!";
• Editor: vi
• How to execute it?
– chmod 755 helloworld.py
– ./ helloworld.py
Python
• The second program blink.py
Python
• Install wiring-x86
– In PC
• Download wiring-x86-master
– https://github.com/emutex/wiring-x86
• Unzip
• Rename the folder name to wiring-x86
• Copy the wiring-x8 folder into the home directory of
your micro SD card
Python
• Install wiring-x86
– In Galileo
• Install wiring-x86 in Galileo
• Change Directory
– /media/mmcblk0p1/wiring-x86
• Entry
– python setup.py install
Python
• program blink.py
– Sorce
• http://www.emutexlabs.com/project/209introduction-to-wiring-x86-for-intel-edison-andgalileo-gen2
Python
• program blink.py
#!/usr/bin/env python
import time
from wiringx86 import GPIOGalileoGen2 as GPIO
gpio = GPIO(debug=False)
pin = 13
state = gpio.HIGH
# Set pin 13 to be used as an output GPIO pin.
print 'Setting up pin %d' % pin
gpio.pinMode(pin, gpio.OUTPUT)
print 'Blinking pin %d now...' % pin
Python
try:
while(True):
# Write a state to the pin. ON or OFF.
gpio.digitalWrite(pin, state)
# Toggle the state.
state = gpio.LOW if state == gpio.HIGH else gpio.HIGH
# Sleep for a while.
time.sleep(0.5)
# When you get tired of seeing the LED blinking kill the loop with Ctrl-C.
except KeyboardInterrupt:
# Leave the LED turned off.
print '\nCleaning up...'
gpio.digitalWrite(pin, gpio.LOW)
# Do a general cleanup. Calling this function is not mandatory.
gpio.cleanup()
References
• https://learn.sparkfun.com/tutorials/galileogetting-startedguide?_ga=1.175151777.2095379488.1416564
981
• http://www.hksilicon.com/kb/articles/335724/x86
Arduino-Intel-Galileo
• http://wiringx86.readthedocs.org/getting_started.html
• http://www.emutexlabs.com/project/209introduction-to-wiring-x86-for-intel-edison-andgalileo-gen2