Firstly, I have just started learning Arduino and I’m in love with it.
I thought I was pretty much done with a project I’m supposed to use tomorrow but I just realized something pretty terrible and I’d like your help.
I am using a light sensor to detect when a roach passes over a specific spot by having a light come on if:
light value goes below set threshold
at least 120 seconds have passed since I pressed a button.
In the meantime, I am also having the serial monitor display the current value of humidity, temperature, and light.
So basically every time the roach goes to that spot, if the light turns on I feed it and press the button. If the roach does it again before 120 seconds have passed the light does not come on and I don’t feed it.
The huge problem is that I used the delay function in a for loop to create a counter. Because of this, the sensors are not updated until the whole interval is passed, which means I have a whole lot of 2 minutes in which nothing happens and the light can’t even turn on.
I’m about to try experimenting with millis() but I’m afraid that I can’t use it to both keep track of the 120 interval and time how often the information is printed to the serial monitor.
I also plan to use an ethernet shield I have (I think I actually have a plain stackable sd shield somehwere) to log this data too. Which brings me more concerns about the timer.
So, technically, it would be incredible If I could have 3 independent timers, but I’m starting to believe I can’t do it, not with the tools I have from tonight till tomorrow
I do have a soldered Adafruit datalogging shield, but I don’t have much experience on how to use the “holes” to solder my jumper wires. Heck, I don’t even know where I’d place them since I’m used to connecting from arduino pins to breadboard.
I hope this post is clear enough for you guys to help me out. Thanks in advance!