Advertisement
Atdiy

Wireless PIR Rev 0.01

Jul 24th, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. CON
  2. _clkmode = xtal1 + pll16x
  3. _xinfreq = 5_000_000
  4.  
  5. XB_Rx = 5 ' XBee DOUT
  6. XB_Tx = 6 ' XBee DIN
  7. XB_Baud = 9600
  8. CR = 13 ' Carriage Return value
  9.  
  10. VAR
  11.  
  12. byte state ' Variable for storing PIR output
  13.  
  14. OBJ
  15. XB : "FullDuplexSerial"
  16.  
  17. Pub Start
  18. XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
  19. dira[0]~ ' Pins 0 to input
  20. XB.str(string("Warming Up..."))
  21. waitcnt(clkfreq * 20 + cnt) ' PIR "warm-up" time
  22.  
  23. repeat
  24. state := ina[0] ' Save state of PIR Sensor
  25. XB.str(string("PIR = "))
  26. XB.dec(state) ' Display results
  27. XB.Tx(CR)
  28. waitcnt(clkfreq/200 + cnt) ' Small delay)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement