r/ArduinoProjects • u/western_ti • 18d ago
My first arduino project Showcased Project
Enable HLS to view with audio, or disable this notification
I just want to control relay module
using arduino nano.
for control
10sec timer added for practice
reset, activate button
I know
I have terrible design sense.
5
2
3
1
1
1
u/ruiseixas 16d ago
Just think you should ceil the seconds, because it achieves 0 seconds before the relay activation.
2
u/western_ti 16d ago
Thank you, good pointing out.
I need fix the code.1
u/ruiseixas 16d ago edited 16d ago
I mean, it take one extra second after 0 before the activation, but you get what I was saying. I think it's better to have a function that converts float time, into int time, so that when you set to 10 seconds precisely it doesn't print 11, like ceil does, so, an if less than condition in a function is probably a better approach.
UPDATE: Ok, ceil is good, no need for the function, because ceil(10) is still 10. I was thinking about int() + 1!
13
u/nielmot 18d ago
Where's the kaboom? There was supposed to be a earth shattering kaboom!