Hello everyone, the main idea is to count not how fast my motor is going but to get him drive some time. I am using opto interrupter now i only try to do this on my breadboard with LED's but unsuccessfully. Here is my program:
i am quite new to programming, sorry if will write nonsenses.
Language: PicBasic Compiler picbasic pro 2.54
Rich (BB code):
ANSEL = 0
OSCCON = $60
TRISB = %00001000
TRISA = %00000000
counts var word
counts = 0
loop
count PORTB.3, 20000, counts ' as i understand it will count 20s.
if counts = 3 then ' if 3 times opto interrupter interrupted then turn on led
high PORTB.4
endif
IF counts = 5 then
high PORTB.5
endif
goto loop
end
Language: PicBasic Compiler picbasic pro 2.54
Last edited: