I’d like to send IR remote control commands to the Tsunami Super WAV Trigger using a Teensy board via the Serial port.
The setup: Teensy, Tsunami Super WAV Trigger and an Off the shelf IR Remote,
Success in receiving commands to the Teensy.
Struggling to wrap my head around the Arduino code to send the IR commands to the Tsunami. Any help out there?
To keep it simple :
IR Remote Button 1 will Play Track 1 on the Tsunami
IR Remote Button 2 will Play track 2, etc
IR Commands
Button
1=0xF30CFF00
2=0xE718FF00
3=0xA15EFF00
4=0xF708FF00
5=0xE31CFF00
6=0xA55AFF00
7=0xBD42FF00
8=0xAD52FF00
9=0xB54AFF00
#include <Tsunami.h>
#include <IRremote.h>
// Assuming IR_RECEIVE_PIN is defined according to your hardware setup
#define IR_RECEIVE_PIN 2
void setup() {
Serial.begin(115200); // Start debugging serial
Serial1.begin(9600); // Begin serial communication with Tsunami
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start IR receiver
}
void loop() {
if (IrReceiver.decode()) {
switch (IrReceiver.decodedIRData.command) {
case 0xF30CFF00: // Example command for “Play”
playTrack(1); // Play track number 1
break;
case 0xD: // Example command for “Stop”
stopAllTracks(); // Stop all tracks
break;
case 0xE: // Example command for “Pause” - Implement based on your logic
pauseTrack(1); // Pause track number 1 (if Tsunami supports direct pause)
break;
// Add more cases as needed
}
IrReceiver.resume(); // Prepare for next command
}
}
void playTrack(int trackNumber) {
// Tsunami track play command format (example, confirm with documentation)
Serial1.write(0x01); // Command byte for “play track”
Serial1.write(trackNumber & 0xFF); // Track number (low byte)
Serial1.write((trackNumber >> 8) & 0xFF); // Track number (high byte) if needed
}
void stopAllTracks() {
// Tsunami stop all tracks command format (example, confirm with documentation)
Serial1.write(0x02); // Command byte for “stop all tracks”
// No additional bytes needed for stop command in this example
}
void pauseTrack(int trackNumber) {
// Assuming Tsunami supports a direct pause command; otherwise, implement custom logic
Serial1.write(0x03); // Command byte for “pause track” - this is hypothetical
Serial1.write(trackNumber & 0xFF); // Track number (low byte) - confirm command structure
// Note: Implement according to Tsunami’s actual support and command format
}