This page gives an overview of Python scripts and code samples that can be used with Andino boards. While most functionality is covered by Andinopy, this page gives an overview of some additional resources for specialized usecases.

The relays of Andino IO and Andino XIO boards can simply be controlled via Python by using the RPi.GPIO library. The relays and inputs are connected to the Raspberry Pi GPIO and can be read by reading their state or controlled by switching them on or off. The correct GPIO pins are, as detailled in the block diagrams for our devices (Andino IO / Andino XIO):

Andino XIO:

Andino IO:

This code sample explains how to use the RPi.GPIO library to control devices (input and relays for Andino XIO):

# Import the library
import RPi.GPIO as GPIO

# Defines GPIO Pins for input(s) and relay(s)
REL1 = 18
INPUT1 = 31

# Set the mode to use physical pin numbers
GPIO.setmode(GPIO.BOARD)

# Set the relay as an output and input as an input
GPIO.setup(REL1, GPIO.OUT)
GPIO.setup(INPUT1, GPIO.IN)

# Turn relay 1 on:
GPIO.output(led, GPIO.HIGH)

# Turn relay 1 off:
GPIO.output(led, GPIO.LOW)

# Print out the status of input 1
print('Status of input 1: ', GPIO.input(INPUT1))

# Free up resources at end of script
GPIO.cleanup()

More detailed documentation on how to control the Raspberry Pi GPIO Pins can be found on this ICS guide by Jeff Tranter or the official library documentation.