Hi tec_support,
actually I was trying to modify the encoder_old driver. I figured out that in the encoder slave program, there are functions in the PackageHandler.cpp (GET_PARAM/TEST_PARAM/SAVE_PARAM) that are used to communicate with the PID tool for PC. I thought I could use the same functions for communicating with the ME Orion.
I just tried retrieving and displaying the PID parameters using the ME Orion with no succes.
-
In the MeEncoderMotor.cpp (Orion side) I added the following function rData which is called in the main program of the arduino:
float MeEncoderMotor::rData()
{
uint8_t w[10] = {0};
uint8_t r[50] = {0};
uint8_t data[2] = {0};
data[0] = _slot;
data[1] = ENCODER_MOTOR_GET_PARAM;
MeHost_Pack(w, 10, 0x01, data, 2);
request(w, r, 10, 50);
encoderParser.pushStr(r, 50);
encoderParser.run();
uint8_t temp[50] = {0};
encoderParser.getData(temp, 50);
float par = ((float )(temp + 2));
int i;
for (i = 0; i < 8; i++) {
float x = (float) temp + i;
Serial.println(*x);
}
return par;
}
-
In the PackageHandler.cpp (slave side) I also added behind the “Serial.write” cmd in the SendParam function, so the data is not only send over the Serial connection, but also back to the Orion:
Wire.write(sendBuf, 50);
The only thing displayed in the serial monitor are all floats of 0.00, while I was expecting to see the parameters? Could you indicate what I’m doing wrong?
thanks,
Wouter