/* * BlinkMCylon -- Create a multi-colored Cylon-like light show with a * chain of several BlinkMs. * Demonstrates how to communicate with multiple BlinkMs * on a single I2C bus. * * BlinkM connections to Arduino * PWR - -- gnd -- black -- Gnd * PWR + -- +5V -- red -- 5V * I2C d -- SDA -- green -- Analog In 4 * I2C c -- SCK -- blue -- Analog In 5 * * There are 13 BlinkMs are addressed from 10..22. * * 2008 Tod E. Kurt, http://thingm.com/ */ #include "Wire.h" #include "BlinkM_funcs.h" int ledPin = 13; //#define num_blinkms 13 #define num_blinkms 3 #define blinkm_start_addr 10 //#define max_t2 1500 #define max_t2 100 //byte blinkm_addrs[num_blinkms] = { // 10,11,12,13,14,15,16, byte curr_blinkm = 0; int incdec = 1; // only +1 or -1 byte t1; // t1 runs from 0-255,0-255,... rolls over int t2 = max_t2; // t2 is the number of t1s to wait before doing cylong thing byte debug = 1; void toggleLed() { digitalWrite( ledPin, digitalRead(ledPin)==HIGH ? LOW : HIGH ); } void setup() { Serial.begin(19200); //Use ledPin to flash when we get stuff pinMode(ledPin, OUTPUT); digitalWrite(ledPin, HIGH); BlinkM_begin(); // set all BlinkMs to known state for( int i=0; i