tommasta

I2C - Slave (written for Rainbowduino) **NOT WORKING**

Mar 24th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <Wire.h>
  2. #include <Rainbowduino.h>
  3. int rx1;  //throttle
  4. int rx2;  //aileron
  5. int rx3;  //elevation
  6. int rx4;  //rudder
  7. int rx7;
  8. int rx8;
  9. void setup() {
  10.  Wire.begin(2);                // Start I2C Bus as a Slave (Device Number 9)
  11. Wire.onReceive(receiveEvent);
  12.  Serial.begin(115200); Rb.init();
  13.  
  14.   rx1 = 0;
  15.   rx2 = 0;
  16. }
  17. unsigned char x,y;
  18. void loop() {
  19.   //If value received is 0 blink LED 1
  20.   if (rx1 > 1700) {
  21.  
  22.     for(x=0;x<8;x++)
  23.     {
  24.      for(y=0;y<8;y++)
  25.       {
  26.       Rb.setPixelXY(x,y,random(0xFF),random(0xFF),random(0xFF)); //uses R, G and B bytes
  27.       }
  28.     }}
  29.     else{
  30.       Rb.blankDisplay();}
  31.   }
Advertisement
Add Comment
Please, Sign In to add comment