Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop() {
- int serialIndex = 0;
- if(Serial.available() > 0){
- while (0 < Serial.available()) { // loop through all the received bytes
- String bufferString;
- uint8_t bufferInt;
- bufferString = Serial.readStringUntil(',');
- bufferInt = bufferString.toInt();
- serialBuffer[serialIndex] = bufferInt; // put current index byte in array
- serialIndex ++; // add index.
- }
- sendBytes();
- }
- delay(50);
- }
- void sendBytes(){
- for(int i = 0; i<boards; i++){
- // int i2cIndex = i*12;
- // for(int j = 0; j <12; j++){
- // i2cBuffer[j] = serialBuffer[j+i2cIndex];
- // }
- Wire.beginTransmission(i+1);
- Wire.write(serialBuffer, 12);
- Wire.endTransmission();
- }
- }
- if(Serial.available() > 0){
- if(Serial.available() == 30){
Add Comment
Please, Sign In to add comment