I guess this is where I get confused with electronics.
I can take a 9V battery and use a resistor to run a 1.5V led without problem but I can't use a resistor the same way to run a 5V chip.
This seems to make sense to everyone but me lol
Ok on to the coding would this chip be able to handle the timer part of this or would I need a dedicated timer chip?
My guess is that there will be about 100 breaks in the beam in a 30 second time.
Currently I'm testing with this code and a led on RB1.
Main:
if PORTB.0 = 1 then
high PORTB.1
else
low PORTB.1
endif
Now that looks like it will work fine but, if the loop happens more than once before the bean is brought back it could count 10 times for every break...
Would this code work and only count once?
broken var byte
broken = 0
Main:
if PORTB.0 = 1 and broken = 0 then
broken = 1
high PORTB.1
else
low PORTB.1
endif
if PORTB.0 = 0 and broken = 1 then broken = 0
goto Main




Bookmarks