maximkulkin / esp-homekit-demo

Demo of Apple HomeKit accessory server library
MIT License
808 stars 233 forks source link

Reverse Behavior #203

Closed ChristianTsch99 closed 5 years ago

ChristianTsch99 commented 5 years ago

I used the example LED. However, the board LED lights up when I activate the LED in HomeKit and not the external one. I suspect that I need to change to gpio_write(led_gpio, on ? 1 : 0), but I don’t know how to with vagrant.

maximkulkin commented 5 years ago

There are two ways to connect an LED: 1) pin, resistor, LED, ground; 2) power, resistor, LED, pin. In first case you need to set pin high to light up LED, in second - low. Usually pins can sink more current than they can source, so second option is used to get LED brighter.

So it all depends on your board schematics.

Not sure I understand the problem with Vagrant.

maximkulkin commented 5 years ago

Ok, maybe I missread the wuestion. If what you were saying is you want to blink with a different LED, you need to change led_gpio to pin number your other LED is connected to.

ChristianTsch99 commented 5 years ago

It's working. My mistake was that I wired the LED like this:

Pin, resistor, led, ground.

maximkulkin commented 5 years ago

Make sure you preserve polarity on LED, shorter leg goes to ground.