View difference between Paste ID: TD1FkJxW and BstjtpLm
SHOW: | | - or go back to the newest paste.
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
13
Pub  Start
14
XB.start(XB_Rx, XB_Tx, 0, XB_Baud)       ' Initialize comms for XBee
15
waitcnt(clkfreq + cnt)
16
dira[2..6]~                              ' Pins 2-6 to input
17
 repeat
18
    if ina[2] == 0
19
      XB.Str(String("Down",13))
20
      XB.Tx(CR)
21
    if ina[3] == 0
22
      XB.Str(String("Left",13))
23
      XB.Tx(CR)
24
    if ina[4] == 0
25
      XB.Str(String("Center",13))
26
      XB.Tx(CR)
27
    if ina[5] == 0
28
      XB.Str(String("Right",13))
29
      XB.Tx(CR)
30
    if ina[6] == 0
31
      XB.Str(String("Up",13))
32
      XB.Tx(CR)
33
    waitcnt(clkfreq / 3  + cnt)