Get the code from TOOLS > Get Board Info or put a custom one
write_id_to_eeprom.ino
charsID[7]="AE0001";// do this only once on an Arduino, // write the Serial of the Arduino in the first 6 bytes of the EEPROM#include<EEPROM.h>voidsetup(){Serial.begin(9600);for(inti=0;i<6;i++){EEPROM.write(i,sID[i]);}}voidloop(){// }
read_id_from_eeprom.ino
// reads the Serial of the Arduino from the // first 6 bytes of the EEPROM#include<EEPROM.h>charsID[7];voidsetup(){Serial.begin(9600);for(inti=0;i<6;i++){sID[i]=EEPROM.read(i);}Serial.println(sID);}voidloop(){// }
#define LED1 13#define LED2 12#define LED3 11#define BTN 4// set LED statesintLED1_state=LOW;intbrightness=0;// previous time for the tasks depending upon time.unsignedlongprevTime_T1=millis();unsignedlongprevTime_T4=millis();// time intervals for the taskslonginterval_T1=1000;// blink every 1 secondlonginterval_T4=5000;// print brightness of LED3 every 5 secondsvoidsetup(){// put your setup code here, to run once:Serial.begin(9600);pinMode(LED1,OUTPUT);pinMode(LED2,OUTPUT);pinMode(LED3,OUTPUT);pinMode(BTN,INPUT_PULLUP);}voidloop(){// put your main code here, to run repeatedly:unsignedlongcurrentTime=millis();// Task 1 : Blink LED1 (T1)if(currentTime-prevTime_T1>interval_T1){LED1_state=!LED1_state;digitalWrite(LED1,LED1_state);prevTime_T1=currentTime;}// Task 2 : Glow LED2 when BTN is pressedif(digitalRead(BTN)){digitalWrite(LED2,LOW);}else{digitalWrite(LED2,HIGH);}// Task 3 : Read input from serial monitor (0-255) and then write to LED3if(Serial.available()){brightness=Serial.parseInt();if(brightness>=0&&brightness<=255){analogWrite(LED3,brightness);}}// Task 4 : print the brightness of LED3 in the serial monitor after every 5 secondsif(currentTime-prevTime_T4>interval_T4){Serial.print("Brightness (0-255): ");Serial.println(brightness);prevTime_T4=currentTime;}}