Using Adafruit HUZZAH ESP8266 Breakout with Thinger

Pulling my hair out trying to read a bit from this board using thinger.io - I am using the arduino IDE. The board works, connects to thinger, reads millis, controls onboard LED but I have a button connected to pin 12 on the esp8266 with the following -

#define inpin 12

Then in setup()
pinMode(inpin, INPUT_PULLUP);

thing[“ledin”] >> outputValue(digitalRead(inpin));

The pin is pulled up and the button does make it low but the info never seems to be sent or shown on the dashboard. I suspect that the pin definition in thinger might be wrong? Is the HUZZAH pinout used here or is it different Any ideas?

Hi,

I guess you want to see is the pin changes at a thinger’s dashboard, am I right? for that you need to stream the value when it changes, the dashboard will show the current state when it is loaded but it will not update the changes.

Check the related documentation —> CODING GUIDE - Thinger.io Documentation

Hope this helps

OK added this code. Serial debug does show switch is pushed (1/0) but nothing seems to be written - thinger debug shows no data writing when button pushed. I have a LED widget setup in the template. Other things are working - millis and builtin LED toggle so I do have communication. Here is the code.

void loop() {
thing.handle();

button = digitalRead(inpin);
if ( button != lastButton ) {
lastButton = button;
Serial.print("button = "); Serial.println(button);
thing[“ledin”] >> outputValue(button);
}
}

Hi,

Please paste your code in the appropriate way, using the “</>” to give code format.

Having the thing[“ledin”] >> outputValue(button); at the loop is a bad idea, it may drain uC memory, you just need to define it once, that is why it is defined at the void setup() function.

You need to stream the value when it changes, check the link, there it explains how to do it.

Other way to do it is by a property, set it when it changes and set the dashboard’s widget to aim to that property, stream the resource is more efficient but the property may work too, here is the related documentation → DEVICES ADMINISTRATION - Thinger.io Documentation

Hope this helps.