What is wrong with this code... All I want is to flip the status of a led regularly like every second.
on system#boot do
timerset,1,1
let,1,1
enddo
on rules#timer=1 do
if %v1% = 1
oled,1,1,"ha"
gpio,0,0
let,1,2
timerset,1,1
else
oled,1,1,"hi"
gpio,0,1
let,1,1
timerset,1,1
endif
enddo
Timer issue.
Moderators: rtenklooster, Voyager, BertB, Stuntteam
-
- New user
- Posts: 3
- Joined: 22 Jan 2020, 19:30
- Location: florida us
Re: Timer issue.
You can add some statement to show a logentry, which may help in debugging. (you already have the oled command, but what if that will update every 2 seconds...)
For example what if the rules are fine, but the LED is not toggling well for whatever reason (e.g. voltage too low or too strong pull up resistor)
You are toggling the value of the variable 1 between 1 and 2.
Just to be sure there is nothing wrong with the if check, can you remove the spaces around the "=", or try replacing it with a "<2" instead of "=1"
For example what if the rules are fine, but the LED is not toggling well for whatever reason (e.g. voltage too low or too strong pull up resistor)
You are toggling the value of the variable 1 between 1 and 2.
Just to be sure there is nothing wrong with the if check, can you remove the spaces around the "=", or try replacing it with a "<2" instead of "=1"
Re: Timer issue.
Ah I noticed this is a duplicate question: viewtopic.php?f=5&t=7399
Please don't ask the same thing in different topics if you don't get an answer immediately.
Please don't ask the same thing in different topics if you don't get an answer immediately.
Who is online
Users browsing this forum: No registered users and 28 guests