Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dim countvariable as word 'store the counting value
P0.0 = 1 'initializing the port0 pin 0
while true 'loop forever
if P0.0 = 0 then 'if the low transition from the optocoupler detected then
countvariable = countvariable + 1 'add +1 to the count variable
do
nop
loop until P0.0 = 1 'make sure the countvariable is receive 1 pulse per count and wait until the pulse is high, if not the countvariable keep adding up as long as the pulse is low
end if
wend
end.