JoyStick playstation PS2 wireless for Arduino แบบไร้สาย พร้อมตัวรับสัญญาณ
รายละเอียดสินค้า
JoyStick playstation PS2 wireless for Arduino แบบไร้สาย พร้อมตัวรับสัญญาณ
#include <PS2X_lib.h> //for v1.6
PS2X ps2x; // create PS2 Controller Class
//right now, the library does NOT support hot pluggable controllers, meaning
//you must always either restart your Arduino after you conect the controller,
//or call config_gamepad(pins) again after connecting the controller.
int error = 0;
byte type = 0;
byte vibrate = 0;
void setup(){
Serial.begin(57600);
//CHANGES for v1.6 HERE!!! **************PAY ATTENTION*************
error = ps2x.config_gamepad(9,7,6,8, true, true); //setup pins and settings: GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
if(error == 0){
Serial.println("Found Controller, configured successful");
Serial.println("Try out all the buttons, X will vibrate the controller, faster as you press harder;");
Serial.println("holding L1 or R1 will print out the analog stick values.");
Serial.println("Go to www.billporter.info for upd...