- Sat Sep 28, 2024 12:09 am
#69653
Hey folks, I'm trying to get the VE table via Serial using another arduino, like if it was tuner studio, but I'm having a really hard time with building the requests and decoding the responses.
This is what I had the most success with but I don't have any idea if it's the right way as I based it only on reading the comms.cpp file. I can get the value of a single cell, but the value is not consistent in amount or order. Anyone has any experience with this and could give me a light?
This is what I had the most success with but I don't have any idea if it's the right way as I based it only on reading the comms.cpp file. I can get the value of a single cell, but the value is not consistent in amount or order. Anyone has any experience with this and could give me a light?
Code: Select all
Sample output im getting:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
mySerial.begin(115200);
Serial.begin(115200);
}
void read_p(byte getData[3])
{
byte res[256];
mySerial.write(getData, 5);
mySerial.read(); // First byte should be only an OK
mySerial.readBytes(res, 256);
Serial.print ("Cell: ");Serial.print(res[0]);Serial.println();
}
void loop() {
byte sendSequence[] = {112, 0, 2, 256, 256}; // p, 0 (can_id), 2 (page), 0 (offset), 256 (length)
read_p(sendSequence);
delay(1000);
}
Code: Select all
Cell: 34
Cell: 34
Cell: 1
Cell: 36
Cell: 36
Cell: 1