(Reference) LED

LEDs - Light Emitting DiodesPermalink

width:512px

WiringPermalink

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

OperationPermalink

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

CodePermalink

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
}

CreditsPermalink

Updated: