Skip to content

Instantly share code, notes, and snippets.

@jaythomas
Created January 19, 2021 15:22
Show Gist options
  • Save jaythomas/56faf188e171e11e31d73bcf0457b042 to your computer and use it in GitHub Desktop.
Save jaythomas/56faf188e171e11e31d73bcf0457b042 to your computer and use it in GitHub Desktop.
Wemos ESP8266 D1 Mini led beacon example
// Wemos Mini D1 Pro pinout. This should have been provided by selecting the correct board but this
// board wasn't available when I looked for it so whatever this requires less dependency on the
// Arduino IDE configuration anyway.
// https://arduino-projekte.info/wp-content/uploads/2017/03/wemos_d1_mini_pro_pinout.png
byte PIN_D0 = 16;
byte PIN_D1 = 5;
byte PIN_D2 = 4;
byte PIN_D3 = 0;
byte PIN_D4 = 2;
byte PIN_D5 = 14;
byte PIN_D6 = 12;
byte PIN_D7 = 13;
byte PIN_D8 = 15;
void setup() {
Serial.begin(115200);
}
void loop() {
// Increase the LED brightness using PWM
for(int dutyCycle = 0; dutyCycle < 1023; dutyCycle++){
analogWrite(PIN_D3, dutyCycle);
delay(1);
}
// Decrease the LED brightness using PWM
for(int dutyCycle = 1023; dutyCycle > 0; dutyCycle--){
analogWrite(PIN_D3, dutyCycle);
delay(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment