#include //Fab Academy 2018 //Networking and communications // I2C, Master and 4 slaves //Gerardo.Saz // ---- MASTER ---- void setup() { Wire.begin(); // join i2c bus (address optional for master) Serial.begin(115200); // start serial for output pinMode(LED_BUILTIN, OUTPUT); Serial.println("Fab Academy 2018"); } void loop() { int num = random(1,4); Wire.beginTransmission(num); Wire.write(1); Wire.endTransmission(); Serial.println("Execute something slave #" String (num)); digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(600); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(500); digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(600); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(500); // wait for a second }