I just got a Lynxmotion wireless controller with the wire harness but am having problems getting it to work right. I’m using a Bot Board II with a Basic Atom Pro 28 and tried following the tutorial but the terminal is filled with only readings of 255 for every function every time except the mode reading which is 7F? The lights on the receiver both stay solid which seems to indicate that a connection is being made. Here is the code I’m using with ATOM-Pro IDE 08.0.1.7:
[code];PS2 Controller / BotBoard II
DAT con P12
CMD con P13
SEL con P14
CLK con P15
PadMode con s79
;-----------------------------
index var byte
temp var byte(19)
mode var byte
LastButton var byte
Small_Motor var byte
Large_Motor var byte
;PS2 controller
high CLK
LastButton(0) = 255
LastButton(1) = 255
sound 9,[50\4000,40\3500,40\3200,50\3900]
main:
gosub PS2INPUT
PS2INPUT:
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[Mode\8]
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
shiftin DAT,CLK,FASTLSBPOST,[temp(0)\8,temp(1)\8,temp(2)\8,temp(3)\8,temp(4)\8,temp(5)\8,temp(6)\8,temp(7)\8,temp(8)\8, |
temp(9)\8,temp(10)\8,temp(11)\8,temp(12)\8,temp(13)\8,temp(14)\8,temp(15)\8,temp(16)\8,temp(17)\8,temp(18)\8]
high SEL
pause 1
;serout s_out,i14400,[dec DS2Mode, 13]
Mode = Mode & 0x7F
if Mode <> PadMode THEN
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;CONFIG_MODE_ENTER
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;SET_MODE_AND_LOCK
high SEL
pause 100
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4F\8,$00\8,$FF\8,$FF\8,$03\8,$00\8,$00\8,$00\8] ;SET_DS2_NATIVE_MODE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$5A\8,$5A\8,$5A\8,$5A\8,$5A\8] ;CONFIG_MODE_EXIT_DS2_NATIVE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8] ;CONFIG_MODE_EXIT
high SEL
pause 1
endif
;-----------Basic Micro IDE terminal----------
; sending carriage return (CR = 13) and the PS2 mode(hex) to the PC
serout S_OUT,i57600,[13, hex2 mode\2] ; Basic Micro Pro IDE <= 08.0.1.7
for index = 1 to 18 ; temp(0) contains a dummy variable so we don’t send it to the PC
; sending all the data to the PC
serout S_OUT,i57600," ", dec3 temp(index)\3] ; Basic Micro Pro IDE <= 08.0.1.7
next
;-----------------------------
goto main[/code]