-->
Page 1 of 1

Adafruit MQTT and capacitive touch

PostPosted: Wed Nov 08, 2017 10:17 am
by Chr37
Hi,

I'm trying to make a wifi controlled led strip dimmer based around a Wemos D1 mini. I've already build the dimmer electronics and got the MQTT communication to OpenHab working. But now I am trying to also make the leds controlled by a capacitive touch button.

But here is the problem: The MQTT library of adafruit requires a 5 second loop where it checks for incoming messages. But whilst checking, it cannot check the capacitive touch button. So to turn off the leds, I sometimes have to touch te button for 5 seconds before they turn off...

Does anyone know of a solution for this problem?

Thanks,
Christian

Re: Adafruit MQTT and capacitive touch

PostPosted: Fri Nov 10, 2017 11:00 pm
by villTech
short answer: you can rewrite your code, so it won't act that way.

or try the ESP8266 PubSubClient library.

Re: Adafruit MQTT and capacitive touch

PostPosted: Sat Nov 11, 2017 12:28 pm
by jarnoldbrown
Yes, use the PubSub client library, and/or attach a ticker routine to check the capacitive button.

Re: Adafruit MQTT and capacitive touch

PostPosted: Sun Nov 12, 2017 6:44 am
by danbicks
I would now use MQTT_Async,

Awesome library for MQTT communication pretty rock solid in my opinion.

Good luck

Dans