From aedc42f9ff57eb7fb456ef6fd9e94c099ff84076 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 29 Jan 2011 23:19:05 +0100 Subject: Initial commit --- Arduino sketch/serial_rgb.pde | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Arduino sketch/serial_rgb.pde (limited to 'Arduino sketch') diff --git a/Arduino sketch/serial_rgb.pde b/Arduino sketch/serial_rgb.pde new file mode 100644 index 0000000..84d331b --- /dev/null +++ b/Arduino sketch/serial_rgb.pde @@ -0,0 +1,28 @@ +#define LEDR 9 +#define LEDG 10 +#define LEDB 11 + +int r, g, b; + +void setup() +{ + pinMode(LEDR, OUTPUT); + pinMode(LEDG, OUTPUT); + pinMode(LEDB, OUTPUT); + r = g = b = 0; + + Serial.begin(9600); +} + +void loop() +{ + if(Serial.available() >= 3) + { + r = Serial.read(); + g = Serial.read(); + b = Serial.read(); + } + analogWrite(LEDR, r); + analogWrite(LEDG, g); + analogWrite(LEDB, b); +} -- cgit v1.2.3-70-g09d2