You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello community!
First of all, thank you all for this super library, I love it! Using this lib I've built an RC monster truck controlled by a wireless Dualshock 2 (not original copy). Now I want to add a feedback from RC model to controller, so I equipped my truck's receiver with a vibration sensor in order to make PS2 controller vibrate as strong as shaky the road surface is!
And it actually works however I noticed that controller vibrates only with motor1 while motor2 stands still. After a short research I found a suggestion to replace ps2x.read_gamepad(false, vibrate); with ps2x.read_gamepad(true, vibrate); to enable motor2. When I do so, motor2 keeps spinning at a constant speed indefinitely and I'm unable to control it by vibrate variable.
Digging deeper in PS2X_lib.cpp, it felt a bit strange that motor1 is controlled by a number 0..255 and motor2 is controlled by boolean true/false value.
Playing around with PS2X::read_gamepad(boolean motor1, byte motor2) function in PS2X_lib.cpp, I've replaced the string byte dword[9] = {0x01,0x42,0,motor1,motor2,0,0,0,0}; with byte dword[9] = {0x01,0x42,0,motor2,motor2,0,0,0,0};. So that boolean motor1 is ignored and byte motor2 value is sent to the controller as a "vibration strength" value for both motors. To my surprise, it worked and now my controller rumbles with both motors as strong as byte motor2 value is.
This is my first Arduino and GitHub experience, so I decided just to share my thoughts and result and may be contribute a bit to this cool library! Thanks for reading!
The text was updated successfully, but these errors were encountered:
Hello community!
First of all, thank you all for this super library, I love it! Using this lib I've built an RC monster truck controlled by a wireless Dualshock 2 (not original copy). Now I want to add a feedback from RC model to controller, so I equipped my truck's receiver with a vibration sensor in order to make PS2 controller vibrate as strong as shaky the road surface is!
And it actually works however I noticed that controller vibrates only with motor1 while motor2 stands still. After a short research I found a suggestion to replace
ps2x.read_gamepad(false, vibrate);
withps2x.read_gamepad(true, vibrate);
to enable motor2. When I do so, motor2 keeps spinning at a constant speed indefinitely and I'm unable to control it byvibrate
variable.Digging deeper in PS2X_lib.cpp, it felt a bit strange that motor1 is controlled by a number 0..255 and motor2 is controlled by boolean true/false value.
Playing around with
PS2X::read_gamepad(boolean motor1, byte motor2)
function in PS2X_lib.cpp, I've replaced the stringbyte dword[9] = {0x01,0x42,0,motor1,motor2,0,0,0,0};
withbyte dword[9] = {0x01,0x42,0,motor2,motor2,0,0,0,0};
. So that boolean motor1 is ignored and byte motor2 value is sent to the controller as a "vibration strength" value for both motors. To my surprise, it worked and now my controller rumbles with both motors as strong as byte motor2 value is.This is my first Arduino and GitHub experience, so I decided just to share my thoughts and result and may be contribute a bit to this cool library! Thanks for reading!
The text was updated successfully, but these errors were encountered: