Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LGT8F328 nano style SPI (PS2 stick) doesnt work #165

Open
vincentj87 opened this issue May 26, 2021 · 5 comments
Open

LGT8F328 nano style SPI (PS2 stick) doesnt work #165

vincentj87 opened this issue May 26, 2021 · 5 comments

Comments

@vincentj87
Copy link

i tried to use lgt8f328 to replace my arduino nano in my recent project which using ps2 stick as main controller. It was running ok with the arduino nano but when i tried to replace it with the lgt8f328 it doesnt work at all

@vincentj87
Copy link
Author

``
#include <PS2X_lib.h>
PS2X ps2x;

int error = 0;
byte type = 0;
byte vibrate = 0;
String condition="diam";

void setup() {
Serial.begin(9600);

error = ps2x.config_gamepad( 8, 12, 4, 11, true, true);// //GamePad(clock, command(MISO), attention(SS), data(MOSI), Pressures?, Rumble?)

if (error == 0) {
Serial.println("Stik terhubung");
}

}

void loop() {
ps2x.read_gamepad(false,vibrate);
if ((ps2x.Analog(PSS_LY)) < 50)
{
condition="MAJU";
//Serial.println("Maju");
//maju();
}
else if ((ps2x.Analog(PSS_LY)) >200)
{
condition="MUNDUR";
//Serial.println("Mundur");
//mundur();
}
else if ((ps2x.Analog(PSS_LX)) > 200)
{
condition="KANAN";
//Serial.println("Kanan");
//kanan();
}
else if ((ps2x.Analog(PSS_LX)) <100 )
{
condition="KIRI";
// Serial.println("Kiri");
//kiri();
}
else{
condition="DIAM";
//Serial.println("diam");
//diam();
}
Serial.print(ps2x.Analog(PSS_LX));Serial.print(" ");
Serial.print(ps2x.Analog(PSS_LY));Serial.print(" ");
Serial.print(ps2x.Analog(PSS_RX));Serial.print(" ");
Serial.print(ps2x.Analog(PSS_RY));Serial.print(" ");
Serial.print(condition);
Serial.println(" ");
delay(50);
}

@vincentj87
Copy link
Author

i also tried to use lgt8f328 for another project which didnt include any SPI protocol , which running fine even with i2c ,

@LaZsolt
Copy link
Collaborator

LaZsolt commented May 26, 2021

In the latest release of the dbuezas/lgt8fx package, which is 1.0.6, the delayMicroseconds() not working correct.
Replace wiring.c and Arduino.h on your hard disk with this files:
https://github.com/dbuezas/lgt8fx/blob/master/lgt8f/cores/lgt8f/wiring.c
https://github.com/dbuezas/lgt8fx/blob/master/lgt8f/cores/lgt8f/Arduino.h

@LaZsolt
Copy link
Collaborator

LaZsolt commented Jan 16, 2023

@vincentj87
Has the new release fixed your PS2 stick issue?

@Schawen
Copy link

Schawen commented Jul 31, 2023

I'm trying to connect RFM95W to LGT8f328P (miniEVB) but getting error code -2 all time.
Where do I find the files that need to get replaced (platformIO / VS Code)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants