LEDs and Button

LEDs

The four processor-controlled LEDs are single color - green - and by default are activity indicators. The LEDs are numbered 1 - 4 proceeding from left to right. You can set the LED state using the following commands:

LED 1 is closest to the terminal blocks and is labeled “1”.

An additional LED is on the side of the E12 next to the antenna. This LED, known as LED A, is controlled via the Linux instance running on the E12.

The other LED, LED B, is controlled via the SNAPpy script running on the internal SM220 module.

Finally, there are two LEDs on the E12 ethernet port. A green LED that indicates the E12 is connected to the network, and a yellow LED that illuminates when the E12 is configured for 100Mbps communications.

SNAP Module-Controlled LED

The unit’s SNAP module controls the tri-color LED on the antenna side of the case (LED B) via GPIO_1 (green) and GPIO_0 (red). (For amber, use both green and red.) This LED is only accessible via the SNAP module. It cannot be controlled by the E12’s AM335x processor, except through calls to the SNAP module.

These two IO lines from the SNAP module will light their respective colors when written high. This sample code demonstrates its use:

from synapse.platforms import *

GREEN=GPIO_1
RED=GPIO_0

@setHook(HOOK_STARTUP)
def onStartup():
    setPinDir(RED, True)
    setPinDir(GREEN, True) LED_off()

def LED_off():
    writePin(RED, False)
    writePin(GREEN, False)

def LED_green():
    writePin(GREEN, True)
    writePin(RED, False)

def LED_red():
    writePin(GREEN, False)
    writePin(RED, True)

def LED_amber():
    writePin(RED, True)
    writePin(GREEN, True)

LED B is the only LED controllable directly from the SNAP module.

Button

The button on the side of the E12 next to the microSD card slot is fully user-accessible. You can monitor the button state at GPIO 112. The E12-buttons package provides a Bash script that prints the button status to STDIO and returns the button status (as 1 for up or 0 for pressed).

You can monitor the AM335x processor GPIO directly rather than using the Bash script if you find that to be easier. Unlike the Bash script that set states on the E12, this script does not require sudo access to run.