This is an example project demonstrating how a Teensy can be used with the NGIMU auxiliary serial in OSC passthrough mode to send/receive custom OSC messages to provide access to the Teensy I/O and peripherals through the NGIMU. OSC messages generated by the Teensy are forwarded by the NGIMU to the host alongside it's own OSC messages; and OSC messages sent by the host to the NGIMU that are not recognised are forwarded to the Teensy. The example setup uses a Teensy 3.2, an analogue joystick, 3 push buttons, and an RGB LED.
This example is intended to serve as a template for user projects. In most cases, only the Receive.cpp
and Send.cpp
files need to be modified. The auxiliary serial baud rate can be increased in the NGIMU settings and setup()
function in the NGIMU-Teensy-IO-Expansion-Example.ino
to achieve higher throughput and lower latency.
/teensy/joystick/xy
- Contains the analogue joystick x and y values (float32). Sent continuously at 10 Hz./teensy/counter
- Contains a counter value (int32) that increments each time the message is sent. Sent continuously at 1 Hz./teensy/button/a
- Contains pin state (boolean). Sent each time button A is pressed or released./teensy/button/b
- Contains pin state (boolean). Sent each time button B is pressed or released./teensy/button/b
- Contains pin state (boolean). Sent each time button C is pressed or released./error
- Contains an error message string argument. Sent if invalid an OSC packet is received by the Teensy.
/teensy/led
- Contains one value to turn the Teensy on-board LED on/off./teensy/rgb
- Contains three values to set the red, green, blue brightness of the RGB LED (0 to 257 = brightest to off)
- 3V3 - NGIMU auxiliary serial interface 3.3 V output
- GND - NGIMU auxiliary serial interface ground
- RX1 - NGIMU auxiliary serial interface TX
- TX1 - NGIMU auxiliary serial interface RX
- 10 - Button A
- 11 - Button B
- 12 - Button C
- A0 - Joystick HORZ
- A1 - Joystick VERT
- 21 - RGB LED red cathode
- 22 - RGB LED geeen cathode
- 23 - RGB LED blue cathode