Created
April 3, 2016 05:50
-
-
Save smching/b061d7917404bfa6d34e880586cf2f07 to your computer and use it in GitHub Desktop.
Arduino communicate with Vixen Lighting Control Software
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Basic Pin setup: | |
------------ ---u---- | |
ARDUINO 13|-> SCLK (pin 25) OUT1 |1 28| OUT channel 0 | |
12| OUT2 |2 27|-> GND (VPRG) | |
11|-> SIN (pin 26) OUT3 |3 26|-> SIN (pin 11) | |
10|-> BLANK (pin 23) OUT4 |4 25|-> SCLK (pin 13) | |
9|-> XLAT (pin 24) . |5 24|-> XLAT (pin 9) | |
8| . |6 23|-> BLANK (pin 10) | |
7| . |7 22|-> GND | |
6| . |8 21|-> VCC (+5V) | |
5| . |9 20|-> 2K Resistor -> GND | |
4| . |10 19|-> +5V (DCPRG) | |
3|-> GSCLK (pin 18) . |11 18|-> GSCLK (pin 3) | |
2| . |12 17|-> SOUT | |
1| . |13 16|-> XERR | |
0| OUT14|14 15| OUT channel 15 | |
------------ -------- | |
- +5V from Arduino -> TLC pin 21 and 19 (VCC and DCPRG) | |
- GND from Arduino -> TLC pin 22 and 27 (GND and VPRG) | |
- digital 3 -> TLC pin 18 (GSCLK) | |
- digital 9 -> TLC pin 24 (XLAT) | |
- digital 10 -> TLC pin 23 (BLANK) | |
- digital 11 -> TLC pin 26 (SIN) | |
- digital 13 -> TLC pin 25 (SCLK) | |
- The 2K resistor between TLC pin 20 and GND will let ~20mA through each | |
LED. To be precise, it's I = 39.06 / R (in ohms). | |
*/ | |
#include "Tlc5940.h" | |
#define CHANNELS_COUNT 16 | |
int incomingData; | |
void setup() | |
{ | |
Serial.begin(9600); // set up Serial at 9600 bps | |
Serial.println("Vixen + TLC5940 demo"); | |
Tlc.init(0); // Call Tlc.init() to setup the tlc. | |
} | |
void loop() | |
{ | |
if (Serial.available() >= CHANNELS_COUNT) { | |
for (int i = 0; i < CHANNELS_COUNT; i++) { | |
incomingData = Serial.read(); //read each byte | |
incomingData = map(incomingData, 0, 255, 0, 4095); //scale to TLC range. | |
Tlc.set(i, incomingData); | |
} | |
Tlc.update(); //sends the data to the TLCs. This is when the LEDs will actually change | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment