Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OBJ
- pst : "FullDuplexSerial" ' Use Serial Terminal object
- CON
- _clkmode = xtal1 + pll16x ' Set clock mode
- _xinfreq = 5_000_000
- VAR
- byte state ' Variable for storing PIR output
- PUB PIR
- dira[0]~ ' Set pin 0 to input
- pst.start(31, 30, 0, 9600) ' Start Terminal at 115200 baud
- waitcnt(clkfreq * 20 + cnt) ' PIR "warm-up" time
- pst.str(string("Warming up..."))
- repeat
- state := ina[0] ' Save state of PIR Sensor
- pst.tx(1) ' Move cursor to upper left
- pst.str(string("State: "))
- pst.dec(state) ' Display results
- pst.tx(13)
- waitcnt(clkfreq/200 + cnt) ' Small delay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement