Grove_4Digital_Display
Grove_4Digital_Display copied to clipboard
Arduino without PC
I coded a program but it is only working with the PC connected. If the PC isn`t connected the Timer doesn´t work properly it only counts up to 2 or 3. I Have no Idea.
[ADUINO UNO R3]
main.zip
I have a few notes not sure if thiese would fix your problem tho
- Sensor() uses pulseIn() function which is blocking this might block execution or atleast make it slower if no pulse is detected. So maybe try commenting line 37
- Timer() counts seconds by sleeping for 1000ms which is not accurate because you don't take into account time it takes to run code (especially unknown pulseIn blocking time). For this I would adapt ideas from non blocking sleep sketch. Basically to use millis() or micros() to check if 1sec have passed.
- Line 100 and 102 don't mix bool with int. Technically it works but readability is worse
- If nothing works I would keep only Timer() inside loop() without any if statement to rule out any mistakes in those
Hello @BodnaBersch,
Have you followed the tips from @Combinacijus? Any updates on the issue now?
Thank you.
@BodnaBersch Hi, does this problem still exist?