Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,782 Views

How to integrate galileo gen 2 with python???????????????

please, help me how to integrated galileo gen2 with python scripting, i.e, how to take inputs & output from pins etc...,

2 Replies
Highlighted
New Contributor I
13 Views

Hi,

Get the library: https://github.com/galileo-chofrock/pyGalileo galileo-chofrock/pyGalileo · GitHub

copy files somewhere in the system, for example in /opt make dir pyGalileo

root@coderdojo-galileo:/opt/pyGalileo# ls -l *.py

-rw-rw-r-- 1 root root 313 mar 31 08:27 Constants.py

-rw-rw-r-- 1 root root 43792 mar 31 08:27 GalileoPins.py

-rw-rw-r-- 1 root root 5304 mar 31 08:27 pyGalileo.py

(pyGalile.py file is __init__.py from GitHub - just rename file ;-)

Now in any python script include :

# !/usr/bin/env python

import sys

galileo_path = "/opt/pyGalileo/"

if galileo_path not in sys.path:

sys.path.append(galileo_path)

from pyGalileo import *

'''/*

This will ON all 13 LEDs...

This example code is in the public domain.

*/

'''

# // the setup routine runs once when you press reset:

def pin_off(led_int):

pinMode(led_int, OUTPUT)

digitalWrite(led_int, LOW)

def pin_on(led_int):

pinMode(led_int, OUTPUT)

digitalWrite(led_int, HIGH)

if __name__ == "__main__":

for pin in range(1,14):

pin_on( pin )

My little article on it (in Polish language) http://www.superbelfrzy.edu.pl/linux-i-wioo/galileo-dalsze-postepy-w-pracy/ http://www.superbelfrzy.edu.pl/linux-i-wioo/galileo-dalsze-postepy-w-pracy/

I hope this will helps YOU

Highlighted
Valued Contributor I
13 Views

Hi

EmuTex has a good library to access Galileo pins from Python.

see

rgb