//***********Protocol 12c*************** //PERIPHERAL BOARD //Original Code: Luis Alberto Hernández | Fab Lab Queretaro //Update Code: José Manuel Díaz | Fab Lab Anáhuac Puebla //Fab Academy 2022 //SAMD 11C14A #include //library for I2C byte own_address = 4; //set own adress. void setup() { Wire.begin(own_address); //enter the bus on specified address Wire.onReceive(receiveEvent);//set the board as reveicer and call a function called receiveEvent pinMode(2, OUTPUT);//set the pin of the led built in as an output digitalWrite(2, LOW);//set the led builtin as low in the begining of the code }//close void setup void loop() { } void receiveEvent(int howMany) { while (Wire.available()) {//while the serial comunication is available using the wire library char c = Wire.read();//use character variable called "c" to store de value of the message sent from the host if(c=='H') {//check the condition if the variable "c" equals the character "H" digitalWrite(2,HIGH);//if this is thruth then turn LED on }//close first if else if(c=='L') // {other whise check if the value of the variable "c" is equal to the character "L" digitalWrite(2,LOW);// if this condition is true then turn LED off }//close second if }//close while