Atdiy

Wireless 5-Position Switch Rev 0.01

Jul 24th, 2012
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 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. OBJ
  11. XB : "FullDuplexSerial"
  12.  
  13. Pub Start
  14. XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
  15. waitcnt(clkfreq + cnt)
  16. dira[0..4]~ ' Pins 0-4 to input
  17.  
  18. repeat
  19. if ina[0] == 0
  20. XB.Str(String("Down",13))
  21. XB.Tx(CR)
  22. if ina[1] == 0
  23. XB.Str(String("Left",13))
  24. XB.Tx(CR)
  25. if ina[2] == 0
  26. XB.Str(String("Center",13))
  27. XB.Tx(CR)
  28. if ina[3] == 0
  29. XB.Str(String("Right",13))
  30. XB.Tx(CR)
  31. if ina[4] == 0
  32. XB.Str(String("Up",13))
  33. XB.Tx(CR)
  34. waitcnt(clkfreq / 3 + cnt)
Advertisement
Add Comment
Please, Sign In to add comment