Programming Examples

Arduino Program to take input from serial and on the led based on input.


Arduino Code to On the LED based on Input

Arduino Program which accept the (R,G,Y) from Serial Input and On the Light Based on Given Input

void setup()
{
  Serial.begin(9600);
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(11,OUTPUT);
}
void loop()
{
	char ch;
  if(Serial.available())
  {
  ch=Serial.read();
  Serial.print(ch);
    if(ch=='r'||ch=='R')
    {
      digitalWrite(13,HIGH);
      digitalWrite(12,LOW);
      digitalWrite(11,LOW);
    }
    else if(ch=='g'||ch=='G')
    {
      digitalWrite(13,LOW);
      digitalWrite(12,HIGH);
      digitalWrite(11,LOW);
    }
    else if(ch=='y' ||ch=='Y' )
    {
      digitalWrite(13,LOW);
      digitalWrite(12,LOW);
      digitalWrite(11,HIGH);
    }
  }
}
Output

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz