i want to built my robot with ps 2 stick and i copy the program from internet but arduino tell error exit 1. this is program
PS2X_Example.ino (7.08 KB)
i want to built my robot with ps 2 stick and i copy the program from internet but arduino tell error exit 1. this is program
PS2X_Example.ino (7.08 KB)
Please post your code (in code tags) and all of the error message.
Hello rashifswijoyo
Please copy and post (using quote) ALL the error message.
Regards,
bidouillelec
At a guess, you haven't installed the PS2X library.
PaulMurrayCbr:
At a guess, you haven't installed the PS2X library.
That's the error I got:
/Users/john/Documents/Arduino/sketch_aug25a/sketch_aug25a.ino:1:34: fatal error: PS2X_lib.h: No such file or directory
#include <PS2X_lib.h> //for v1.6
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
I hope this is the right library: GitHub - madsci1016/Arduino-PS2X: Read a Playstation 2 Gamepad or Guitar Hero Controller using an Arduino
Adding the library allows the sketch to compile with only some warnings:
/Users/john/Documents/Arduino/libraries/PS2X_lib/PS2X_lib.cpp: In member function 'boolean PS2X::read_gamepad(boolean, byte)':
/Users/john/Documents/Arduino/libraries/PS2X_lib/PS2X_lib.cpp:96:54: warning: narrowing conversion of 'motor2' from 'byte {aka unsigned char}' to 'char' inside { } [-Wnarrowing]
char dword[9] = {0x01,0x42,0,motor1,motor2,0,0,0,0};
^
/Users/john/Documents/Arduino/libraries/PS2X_lib/PS2X_lib.cpp:154:36: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
buttons = *(uint16_t*)(PS2data+3); //store as one value for multiple functions
^
Sketch uses 6618 bytes (20%) of program storage space. Maximum is 32256 bytes.
Global variables use 1320 bytes (64%) of dynamic memory, leaving 728 bytes for local variables. Maximum is 2048 bytes.
rashifswijoyo:
i want to built my robot with ps 2 stick and i copy the program from internet but arduino tell error exit 1. this is program
Arduino-PS2X-master.zip (13.4 KB)
What is the FULL error message? You can copy and paste it from the text box below your sketch.