Finding PS2 for DDR compatible with Mega or 2560

So my issue is that everyone is using the same code for the PS2X to Ardiuno controller but I just purchased the 2560 or Mega2560 and here is the error message I am getting:


This is what I am capable of doing. The only issue is that my level of understanding code is so minnimal, I spent an entire night trying/ crying just to figure out how to code for 4 touch sensor buttons linked to a breadboard and the Mega2560. Again I found a usable PS2 code because I only need the buttons LEFT, RIGHT, UP, DOWN, START, SELECT, AND X.

I will also be open to if you only need to write like one or two lines of the code.

C:\Users\angel\AppData\Local\Temp\ccmLQH96.ltrans0.ltrans.o: In function `main':

C:\Users\angel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/main.cpp:43: undefined reference to `setup'

C:\Users\angel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/main.cpp:46: undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Publish your program as text and properly formatted - this image is not useful to anyone. Post a diagram of your actual wiring - with pen drawn on paper is a very good option. If you don't have external pullup resistors better use INPUT_PULLUP instead of INPUT for the pins.

const int SENSOR_PIN = 2;
const int SENSOR_PIN2 = 3;
const int SENSOR_PIN3 = 4;
const int SENSOR_PIN4 = 5;

void setup ()
{
  Serial.begin ( 115200 );
  pinMode ( SENSOR_PIN, INPUT_PULLUP );
  pinMode ( SENSOR_PIN2, INPUT_PULLUP );
  pinMode ( SENSOR_PIN3, INPUT_PULLUP );
  pinMode ( SENSOR_PIN4, INPUT_PULLUP );
}

void loop ()
{
  int state = digitalRead ( SENSOR_PIN );
  Serial.println ( state );
  delay ( 20 );
}

According to the simulator, the program is compiled and executed.

These errors seem to indicate that your sketch is empty. That is very strange.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.