Hi Paul,
For debugging purpose, i did this:
//#include "UnoJoy.h"
#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 12); // RX, TX
int axisValue[2];
void setup(){
// setupUnoJoy();
mySerial.begin(38400);
Serial.begin(38400);
}
void loop(){
if (mySerial.available() > 0) {
int but1 = mySerial.parseInt();
int but2 = mySerial.parseInt();
int but3 = mySerial.parseInt();
int but4 = mySerial.parseInt();
int xValue = mySerial.parseInt();
int yValue = mySerial.parseInt();
if (mySerial.read() == '\n') {
axisValue[0] = map(xValue,0,1023,0,255);
axisValue[1] = map(yValue,0,1023,0,255);
Serial.print (but1);
Serial.print (", ");
Serial.print (but2);
Serial.print (", ");
Serial.print (but3);
Serial.print (", ");
Serial.print (but4);
Serial.print (", ");
Serial.print (axisValue[0]);
Serial.print (", ");
Serial.println (axisValue[1]);
}
}
// dataForController_t controllerData = getControllerData();
// setControllerData(controllerData);
}
/*
dataForController_t getControllerData(void){
dataForController_t controllerData = getBlankDataForController();
controllerData.leftStickX = axisValue[0];
controllerData.leftStickY = axisValue[1];
return controllerData;
}
*/
Then fire it up, and here's the output at the serial monitor (let's say the data format is a, b, c, d, e, f):
0, 0, 0, 0, 128, 128
Everything looks normal. When i wiggle my joystick at the remote control, the values of e and f changed between 0 to 255.