It turns out that this is connected to the same line that drives Arduino pin 13. On the Gen 2, this is driven by linux GPIO 7 (on the Gen 1 it was linux GPIO 39).
It is quite simple to make this LED blink using an arduino sketch, but that is boring and we are not going to talk about that here. I am not generally a Python fan, but I found a nice Python library (and well written too), called "wiring-x86".
It was a simple matter to clone this, change one line in one of the examples, and have that LED blinking, as follows:git clone https://github.com/emutex/wiring-x86.git make install running install running build running build_py creating build creating build/lib copying wiringx86.py -> build/lib running install_lib copying build/lib/wiringx86.py -> /usr/lib/python2.7/site-packages byte-compiling /usr/lib/python2.7/site-packages/wiringx86.py to wiringx86.pyc running install_egg_info Writing /usr/lib/python2.7/site-packages/Wiring_x86-1.0.0-py2.7.egg-info python Python 2.7.3 (default, May 12 2016, 08:33:18) [GCC 4.9.1] on linux2I edit one line in examples/blink,py as follows:
#from wiringx86 import GPIOEdison as GPIO from wiringx86 import GPIOGalileoGen2 as GPIOA pruned down version of the script is:
import time from wiringx86 import GPIOGalileoGen2 as GPIO gpio = GPIO(debug=False) pin = 13 state = gpio.HIGH gpio.pinMode(pin, gpio.OUTPUT) while(True): gpio.digitalWrite(pin, state) state = gpio.LOW if state == gpio.HIGH else gpio.HIGH time.sleep(0.5)I run this as python blink.py and it works like a champ! These Emutex dudes have more than a clue.
#!/bin/sh echo -n 7 >/sys/class/gpio/unexport echo -n 7 >/sys/class/gpio/export echo -n 46 >/sys/class/gpio/unexport echo -n 46 >/sys/class/gpio/export echo -n 30 >/sys/class/gpio/unexport echo -n 30 >/sys/class/gpio/export echo -n 31 >/sys/class/gpio/unexport echo -n 31 >/sys/class/gpio/export echo -n low >/sys/class/gpio/gpio46/direction echo -n low >/sys/class/gpio/gpio30/direction echo -n in >/sys/class/gpio/gpio31/direction echo -n strong >/sys/class/gpio/gpio46/drive echo -n strong >/sys/class/gpio/gpio30/drive echo -n hiz >/sys/class/gpio/gpio31/drive echo -n 0 >/sys/class/gpio/gpio46/value echo -n 0 >/sys/class/gpio/gpio30/value echo -n low >/sys/class/gpio/gpio7/direction #echo -n strong >/sys/class/gpio/gpio7/drive while true do echo -n 1 >/sys/class/gpio/gpio7/value sleep 0.3 echo -n 0 >/sys/class/gpio/gpio7/value sleep 0.3 doneThis does a fine job of blinking the LED also. Here it is clear that it is accessing the gpio via the linux "sysfs" interface, which I find quite byzantine. It certainly works, and this is exactly what python wiring-x86 and most likely the arduino libraries are doing.
You hopefully are asking why it is necessary to fiddle with GPIO 46, 30, and 31 also when we know that it is GPIO 7 that controls the LED. If you look at wiring-x86, you will find a set of tables for each pin. In this case the table of interest is GPIO_MUX_OUTPUT. This table provides for each pin, a list of other pins and the state they must be placed into to allow the pin to be used for GPIO. In some cases these control a pin multiplexor, in other cases they do other things. More about this elsewhere.
Tom's Computer Info / tom@mmto.org