Answers for "toggle led arduino"

0

toggle led arduino

// We name pin D0 as led
int led = D0; 

// This routine runs only once upon reset
void setup() 
{
  // Initialize D0 pin as an output
  pinMode(led, OUTPUT);
}

// This routine loops forever 
void loop() 
{
  digitalWrite(led, !digitalRead(led));   // Toggle led
  delay(5000);              
}
Posted by: Guest on April-16-2021

Browse Popular Code Answers by Language