SamZorSec / Open-Home-Automation

Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
MIT License
960 stars 197 forks source link

Problem with brightness #8

Closed matt123p closed 7 years ago

matt123p commented 7 years ago

I believe line 95 should read:

uint8_t brightness = map(m_rgb_brightness, 0, 100, 0, 255);

i.e. the 1023 should be 255. I correct this and it made the brightness function correctly.

Many thanks for a great project.

Matt.

SamZorSec commented 7 years ago

Thank you for your comment. Can you tell me the name of the sketch? I've made some corrections a few weeks ago about that.

I've normally reduce the resolution of the analog pin with (1023 by default): analogWriteRange(255);

And use this map function: uint8_t brightness = map(m_rgb_brightness, 0, 100, 0, 255);

EDIT: You're right, I forgot to modify the ha_mqtt_rgb_lightsketch.