arduino i2c guitar effects control receiver
kevinl7778
0 Likes0 Commentsc_cpp#include <Wire.h> int ledB[]{13,12,11,10,9,8,7,6,5}; int ledA[]{4,3,2, 1, 0, A0, A1, A2, A3}; int DelayTime = 50; int comm1 = 4; void setup() { for (int i; i<9; i++) {pinMode(ledB[i], OUTPUT); pinMode(ledA[i], OUTPUT);} for (int i = 0; i <= 8; i++) {digitalWrite(ledB[i], HIGH);}//remove for real world for (int i = 0; i <= 8; i++) {digitalWrite(ledA[i], HIGH);}//remove for real world Wire.begin(comm1); Wire.onReceive(receiveEvent); Serial.begin(9600); } void loop() { } void receiveEvent(int howMany) {int x = Wire.read(); Serial.println(x); if (x==0) {digitalWrite(ledB[0],LOW);} else{digitalWrite(ledB[0],HIGH);} } //{for (int i=0; i<=9; i++) // {a[i]= Wire.read(); Serial.println(a[i]); (a[i]==1){digitalWrite(ledB[i],LOW);}}