Start a new topic

How to turn ON 3 LEDs with Arduino NANO

Hello everyone,


I have spent a lot of hours trying to understand how can I turn ON / OFF 3 LEDs attached on my arduino.


I am using button b0 b1 and bt0


can someone please help me, I get led on pin13 to turn on/off but not the others.


Commucation to the display I understand but commucation from Display to do some action in arduino I cannot understand very well.


Here is the code I am using:


  

int char1,char2;
int charflag=0;

void setup() {
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}

void loop() {
 if (Serial.available()>1) 
{
  Serial.print(Serial.read());
 if (charflag)  
  {
  char2=Serial.read();
  if (char2==0) digitalWrite(13,HIGH);
  else if (char2==0x01) digitalWrite(13,LOW);
  charflag=0;
  }
  else
  {
   char1=Serial.read();
   if(char1==0x65) charflag=1;
  }
}
} 

  Thanks in advance


1 person likes this idea
1 Comment

 can you did that? I need make that

Login or Signup to post a comment