Shop OBEX P1 Docs P2 Docs Learn Events
Playstation 2 controller help — Parallax Forums

Playstation 2 controller help

ACE227ACE227 Posts: 15
edited 2010-03-01 12:22 in Propeller 1
I am using the propeller to controll a robot for a competition. I have downloaded the PS2_Controller_Serial_Demo object and·I have the·PS2 controller·comunicating with the propeller. I am now stuck because I dont know how to take binary digits·I have displayed into the variables that·I have declared. Please help. The top file is robot.spin.

Thanks,
Ace227

Comments

  • Graham StablerGraham Stabler Posts: 2,510
    edited 2010-02-26 21:35
    Is your issue that the PS2.get_RightY type functions return longs and you want to assign their least significant byte to your byte sized variables?
  • ACE227ACE227 Posts: 15
    edited 2010-02-26 22:37
    My issue is with assigning the buttons on the PS2 controller to the variables that i have listed.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-02-26 22:47
    Assuming the comments are correct.
    data1 := PS2.get_Data1
    DPAD_LEFT := data1 & %10000000
    DPAD_DOWN := data1 & %01000000
    etc
    data2 := PS2.get_Data2
    KEY_L2 := data2 & %00000001

    John Abshier
  • ACE227ACE227 Posts: 15
    edited 2010-03-01 12:22
    Thanks but actually the get_Data1 controlls all the buttons on the controller but I have the idea now.
Sign In or Register to comment.