× Ship hàng toàn quốc cho đơn hàng 100k trở lên. Phí ship chỉ từ 11k Xem bảng phí ship
× Ship hàng toàn quốc Bảng phí ship
Tay cầm Sony PS2 có dây

Tay cầm Sony PS2 có dây
Tồn kho: 4 (Lượng tồn kho thực tế)
Giá: 195,000 VNĐ

Hỗ trợ online



Mã sản phẩm:
#NH1304

Nguồn gốc xuất xứ:
Trung Quốc

Mô tả sản phẩm:
Tay cầm Sony PS2 có dây

Chi tiết sản phẩm
Download library

#include
//Khai bao chan PS2
#define PS2_DAT 13
#define PS2_CMD 11
#define PS2_SEL 10
#define PS2_CLK 12
//Khai bao chan dieu khien relay
#define relay 8

//#define pressures true
#define pressures false
//#define rumble true
#define rumble false

PS2X ps2x; // create PS2 Controller Class
int error = 0;
byte type = 0;
byte vibrate = 0;

void setup() {
// put your setup code here, to run once:
pinMode(relay, OUTPUT);

Serial.begin(57600);
digitalWrite(relay, HIGH);
delay(300);
//setup pins and settings: GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT, pressures, rumble);

if(error == 0){
Serial.print("Found Controller, configured successful ");
Serial.print("pressures = ");
if (pressures)
Serial.println("true ");
else
Serial.println("false");
Serial.print("rumble = ");
if (rumble)
Serial.println("true)");
else
Serial.println("false");
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("Note: Go to www.billporter.info for updates and to report bugs.");
}
else if(error == 1)
Serial.println("No controller found, check wiring, see readme.txt to enable debug. visit www.billporter.info for troubleshooting tips");

else if(error == 2)
Serial.println("Controller found but not accepting commands. see readme.txt to enable debug. Visit www.billporter.info for troubleshooting tips");

else if(error == 3)
Serial.println("Controller refusing to enter Pressures mode, may not support it. ");

type = ps2x.readType();
switch(type) {
case 0:
Serial.print("Unknown Controller type found ");
break;
case 1:
Serial.print("DualShock Controller found ");
break;
case 2:
Serial.print("GuitarHero Controller found ");
break;
case 3:
Serial.print("Wireless Sony DualShock Controller found ");
break;
}
}

void loop() {
// put your main code here, to run repeatedly:
if(error == 1) //skip loop if no controller found
return;
if(type == 2){
ps2x.read_gamepad();
}
else
{
ps2x.read_gamepad(false, vibrate);
vibrate = ps2x.Analog(PSAB_CROSS);
if (ps2x.NewButtonState())
{
if(ps2x.Button(PSB_L1))
{
digitalWrite(relay, LOW);
}
else
{
digitalWrite(relay, HIGH);
}
}
}
}





Sản phẩm liên quan
[Size lớn] Đồng hồ điện tử để bàn LCD - Thời Gian, Lịch, Báo Thức, Nhiệt Độ (Có đèn)
Hàng còn 1 cái
Đồng hồ thời gian, nhiệt độ, độ ẩm HTC-1 có chuông báo thức
Hàng còn 15 cái
[Size nhỏ] Đồng hồ điện tử để bàn LCD - Thời Gian, Lịch, Báo Thức, Nhiệt Độ (Có đèn)
Hàng còn 6 cái
Sạc Dự Phòng 16000mAh Pin 21700 Sạc nhanh 22.5W Type-C USB PD Lightning
-Tạm hết hàng
Box Sạc Dự Phòng 22.5W Type-C PD Lightning 4 Cell Pin 21700 Sạc siêu nhanh
Hàng còn 3 cái
Sạc Dự Phòng 20000mAh Pin 21700 Sạc nhanh 22.5W Type-C USB PD Lightning
Hàng còn 2 cái
Que đo nhiệt độ dùng pin TP101
Hàng còn 10 cái
Đầu đọc thẻ nhớ MicroSD
Hàng còn 151 cái
Tay cầm Sony PS2 không dây (Kèm adapter giao tiếp SPI cho Arduino)
Hàng còn 6 cái
Tay cầm Sony PS2 không dây
-Tạm hết hàng
Đèn led USB siêu sáng 24 bóng 5V 12W
-Tạm hết hàng
USB Bluetooth Audio (Tích hợp pin) - Loại tốt
-Tạm hết hàng
Đồng hồ led để bàn 160x61x25mm - Thời Gian, Lịch, Báo Thức, Nhiệt Độ
-Tạm hết hàng