-->
Page 1 of 2

Working from home time tracker with LED and IFTTT interface

PostPosted: Fri Jan 19, 2018 2:35 am
by mattyams
So I want to take this idea http://www.simpleiothings.com/build-a-10-wifi-smart-button/ and this idea/3d print https://mylifeasa.tinkerer.us/philips-hue-remote-using-esp8266-6afaf76ac8a8 and put them together to be able to track my hours when working from home.

I have the code for sending button presses to IFTTT > Google Sheets figured out. My problem is the LED for the box and how I want it to work. I am at a complete loss on how to code it. Basically I have an RGB LED and I want it to blink blue a few times when first pressed, then stay steady red until pressed again then flash green.

Is there a way to do this with just an ESP8266, a button and an RGB LED?

Re: Working from home time tracker with LED and IFTTT interf

PostPosted: Sat Jan 20, 2018 5:37 am
by Luc Volders
piece of cake.

Look at ESP-Basic which has its home on this forum. You can do this in a few minutes coding.

Look at interrupts with ESP-Basic.
When a button is pressed an interrupt is generated.
Interrupt routine sends to IFTTT
And the routine sets the color of the led.

For a quick tutorial that handles IFTTT and shows how to flash Neopixels (RGB led) you can look at my weblog:

http://lucstechblog.blogspot.nl/2017/03 ... p8266.html

Using that as a base most work will already be done.

Luc

Re: Working from home time tracker with LED and IFTTT interf

PostPosted: Mon Jan 22, 2018 11:35 pm
by mattyams
Thank you! I am now reworking everything and it seems a bit easier. I might have a few questions later down the road.

Re: Working from home time tracker with LED and IFTTT interf

PostPosted: Tue Jan 23, 2018 6:03 pm
by mattyams
So I have gotten to the point to where I can get IFTTT to accept the trigger and the LEDs to flash when first pushed then keep flashing after. I am hung up on how to "turn it off" so to speak. Here is what I got so far. (I understand the "loop until 0" is infinite loops, I just know know what to code to get it to "stop")

Code: Select allio(po,d1,0)
io(po,d2,0)
io(po,d4,0)
interrupt d3, [start]
wait

[start]
io(laststat,d3) = 1
io(po,d1,1)
delay 500
io(po,d1,0)
delay 500
io(po,d1,1)
delay 500
io(po,d1,0)
print wget("maker.ifttt.com/trigger/button_pressed/with/key/cA5NcIsbXndi_RtfBfGrRB?value1=1&value2=two&value3=333")
delay 500
do
  io(po,d4,1)
  delay 500
  io(p0,d4,0)
  delay 500
loop until 0