Advertisement
Atdiy

Wireless 2-Axis Joystick v0.01

Jul 24th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. CON
  2. _clkmode = xtal1 + pll16x
  3. _xinfreq = 5_000_000
  4.  
  5. XB_Rx = 0 ' XBee DOUT
  6. XB_Tx = 1 ' XBee DIN
  7. XB_Baud = 9600
  8. CR = 13 ' Carriage Return value
  9.  
  10. OBJ
  11. XB "FullDuplexSerial"
  12. rc : "RCTime"
  13. Pub Start | UD, LR
  14. XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
  15.  
  16. waitcnt(clkfreq + cnt)
  17.  
  18. repeat
  19. rc.rctime(0, 1, @LR)
  20. rc.rctime(1, 1, @UD)
  21. XB.Str(String("UD = "))
  22. XB.dec(UD)
  23. XB.Str(String(", LR = "))
  24. XB.dec(LR)
  25. XB.tx(13)
  26. waitcnt(clkfreq / 2 + cnt) ' 1/2 second delay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement