(Reference) LED

LEDs - Light Emitting Diodes

width:512px

Wiring

Screenshot 2024-07-04 at 12.31.44 AM

  • Anode (longer leg) connects to resistor and Photon 2
  • Cathode (shorter leg) connects to GND

LED

Operation

  • HIGH output turns LED on
  • LOW output turns LED off

Code

const int PIN_LED = D2;   //pin D2

void setup() {
  //initialize the pin mode
  pinMode(PIN_LED, OUTPUT);
}

void loop() { 
  digitalWrite(PIN_LED, HIGH); //turn LED on
  delay(100);				   //delay 100 ms
  digitalWrite(PIN_LED, LOW);  //turn LED off
  delay(100);		         //delay 100 ms
}

Credits

Updated: