Esphome example blink: Difference between revisions

From Notebook
Jump to navigation Jump to search
(Created page with " <nowiki># Blink the green LED on D1 (GPIO4) output: - platform: gpio pin: number: D3 mode: output id: greenLED interval: - interval: 500ms then: - output.turn_on: greenLED - delay: 250ms - output.turn_off: greenLED</nowiki>")
 
No edit summary
Line 1: Line 1:
You would think that blinking an LED is a no-brainer, but in ESPHome there are many methods that you can use to blink an LED on a GPIO port.<br>
The most complex is to use a PWM output, but I just wanted to blink an LED.<br>


  <nowiki># Blink the green LED on D1 (GPIO4)
  <nowiki># Blink the green LED on D5 (GPIO14)
output:
output:
   - platform: gpio
   - platform: gpio
     pin:
     pin:
       number: D3
       number: D5
       mode: output
       mode: output
     id: greenLED
     id: greenLED

Revision as of 08:54, 27 August 2023

You would think that blinking an LED is a no-brainer, but in ESPHome there are many methods that you can use to blink an LED on a GPIO port.
The most complex is to use a PWM output, but I just wanted to blink an LED.

# Blink the green LED on D5 (GPIO14)
output:
  - platform: gpio
    pin:
      number: D5
      mode: output
    id: greenLED

interval:
  - interval: 500ms
    then:
      - output.turn_on: greenLED
      - delay: 250ms
      - output.turn_off: greenLED