Interface with Vixen
This week I am going to write some code to interface with my LED device.
I want to sync my LED lights with music.
-------------
Software Setup
I find a software called Vixen. It is really powerful for controlling lights and sycning with music.
I followed this tutorial to set up the software.
-------------
I can edit the on and off for each channel in the Vixen software
Setting up serial com with my board.
-------------
Code
The code basiclly tells my board to receive byte from Vixen
then turn on and off the LEDs
const int numChannels = 5;
// List Arduino pins in Channel number order
int channels[numChannels] = {2,3,4,5,6};
int incomingByte[numChannels];
void setup()
{
Serial.begin(9600);
for(int i = 0; i < numChannels; i++){
pinMode(channels[i], OUTPUT);
// Start with lights turned off
//digitalWrite(channels[i],0);
digitalWrite(channels[i],0);
}
}
void loop()
{
if (Serial.available() >= numChannels){
for(int i = 0; i < numChannels; i++){
incomingByte[i] = Serial.read();
}
for(int i = 0; i < numChannels; i++){
//digitalWrite(channels[i], incomingByte[i]);
digitalWrite(channels[i], 255-incomingByte[i]);
}
}
}
The Show
-------------
-------------
-------------