Tutorial 1: Handling simple input and output devices

Objective: Learn how to manage simple input and output devices, using XOD programming.

Requirements: Computer loaded with XOD and board driver, Rich UNO R3 board from Biomaker starter kit.


 Touch buttons for user input

The Rich UNO R3 board has four touch sensitive pads that behave as switches. They are labelled TCH1-4, and are wired to ports D3-D6. The switches are normally fixed at a high logic level, and drop to low when touched. The Button node in XOD includes debouncing of key-switching, and can be used to detect user input. The output can be inverted using a Not node, if required - and used to trigger or control other events.

For example, an LED can be connected to a port, connected and controlled by use of a switch and Button node.

Further, multiple buttons and LEDs can be added and connected on the XOD workspace. In the patch below, touch buttons are connected to a 3-colour RGB LEDs via a not node to invert the signal, then fed to a flip-n-times node. The flip-n-times node can be set to turn on and off a set number of times, and the cycle of on-off times can also be set. The output is used to control the brightness of LEDs. In addition, a fourth button is used to provide a reset signal if required.

s-l1600 copy.jpg

Piezoelectric Buzzer

A piezo-electric buzzer is provided on the Rich UNO R3 board, positioned adjacent to the 4-digit display. It is connected to output D9, and this can be driven to create an audible warning. The flip-n-times node can be used to generate a repeating alert.

The Rich UNO R3 board contains a passive piezo buzzer that is connected to port D9. Marco Aita has encapsulated the Arduino tone library in a XOD node that can be used to switch on and control the pitch of the buzzer.

Identify the buzzer node, copy into a patch and experiment with the use of inputs from other devices on the shield, such as the variable resistor and photoresistor. The buzzer provides a useful device for audible alarms.