Drink It
Drink It! is an initiative to drink more water and keep track of it. In this manual we are only going to dive into one of the few approaches.
Supplies
For this manual you will need:
- Led/Display (i will use a LED strip because i don't have a display)
- NodeMCU (i am using ESP8266)
- An USB to connect the node to your laptop
- Arduino Program (installed)
- NeoPIX (Downloaded in Arduino)
Open a new document in Arduino and get the basics ready.
Dont forget to connect the LED-strip to the computer.
Put the three wires on the good nodepins. +5v on 3v3, GND on GND and Din on D5 (in my case, you can put it on another D but you have to replace my 5 by that number in order to let it work for you)
So now that we have the basics. We will start with another basic step, just to get us comfortable with the code.
Our goal is to get the LED strip to blink 3 times every hour. Let's start by letting them blink/flash in the first place!
We are going to do this by making a loop and setting a delay.
------
I had to put the middle wire to D1 for it to work, Pin 5 works with D1.
First i forgot that the delay is in miliseconds and not seconds.
Second of all i forgot to put the 'if / else' so it did not do anything.
Downloads
Now they are blinking! Now we want flashes every hour.
So we need a loop that they will flash and then a delay for an hour.
We will put a pixelClear code with a delay of an hour. An hour in miliseconds is 3600000. This is an easy step if you did the one before. In this step you do not need toggle between colors or the lack of color.
------
I forgot '}' that's why i had an error, so do not forget that one :)
Also the flash that goes off is 1 second/1000 miliseconds so the hour delay should be 3600000-1000=3599000 otherwise it will be quite off on the long run