aboutsummaryrefslogtreecommitdiff
path: root/Arduino/i2cNeopixelSlave.ino
diff options
context:
space:
mode:
authorJakob Stendahl <jakob@Jakobs-MacBook-Pro.local>2016-09-21 14:35:01 +0200
committerJakob Stendahl <jakob@Jakobs-MacBook-Pro.local>2016-09-21 14:35:01 +0200
commitf722493973f362b7a714f9a3b3058386ac1c5dcf (patch)
tree945de49ef997c9240c7997975ed8191e8bd573c5 /Arduino/i2cNeopixelSlave.ino
parent1b9289759f68535a8a7d8525897f3be60767c479 (diff)
downloadi2c-Neopixel-f722493973f362b7a714f9a3b3058386ac1c5dcf.tar.gz
i2c-Neopixel-f722493973f362b7a714f9a3b3058386ac1c5dcf.zip
Update
Diffstat (limited to 'Arduino/i2cNeopixelSlave.ino')
-rw-r--r--Arduino/i2cNeopixelSlave.ino95
1 files changed, 0 insertions, 95 deletions
diff --git a/Arduino/i2cNeopixelSlave.ino b/Arduino/i2cNeopixelSlave.ino
deleted file mode 100644
index dd9f7e0..0000000
--- a/Arduino/i2cNeopixelSlave.ino
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <Wire.h>
-#include <Adafruit_NeoPixel.h>
-
-
-#define PIN 3
-#define SLAVE_ADDRESS 0x04
-
-// Parameter 1 = number of pixels in strip
-// Parameter 2 = pin number (most are valid)
-// Parameter 3 = pixel type flags, add together as needed:
-// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
-// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
-// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
-// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
-Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, PIN, NEO_GRB + NEO_KHZ800);
-
-int number = 0;
-int state = 0;
-
-void setup() {
-
- pinMode(13, OUTPUT);
- Serial.begin(9600);
-
- Wire.begin(SLAVE_ADDRESS);
-
- Wire.onReceive(receiveData);
- Wire.onRequest(sendData);
-
- strip.begin();
- strip.show(); // Initialize all pixels to 'off'
-
- Serial.println("Ready!");
-
-}
-
-void loop() {
- delay(100);
-}
-
-void receiveData(int byteCount) {
- int bytes[byteCount];
- int i = 0;
-
- while (Wire.available()) {
- number = Wire.read();
- bytes[i] = number;
-
- Serial.println(number);
- i++;
- }
-
- switch (bytes[0]) {
-
- case 0x01:
- Serial.println("Life is discovered");
- number = 1;
- break;
-
- case 0x02:
- /*long byteN = bytes[1];
- int byteState = bytes[2];
- int byteGreen = bytes[3];
- int byteRed = bytes[4];
- int byteBlue = bytes[5];*/
- Serial.println("0x02");
-
- strip.setPixelColor(bytes[2], bytes[3], bytes[4], bytes[5]);
- Serial.println(bytes[1]);
- Serial.println(bytes[2]);
- Serial.println(bytes[3]);
- Serial.println(bytes[4]);
- break;
-
- case 0x03:
- strip.show();
- break;
-
- default:
- Serial.println("Nothing New");
- break;
-
- }
-
-}
-
-void sendData() {
- Wire.write(number);
-}
-
-void sendString(int Data) {
- Wire.write(Data);
-}
-
-