Ok, Thanks to Paul, I managed to get my radios working.
I've managed to get heading, obs, and ias working for an AP.
But having issues with altitude.
send_padded("altitude", alt/100,4); // alt was 600 so sends 6 to the function
void send_padded ( char* name, int value, int padded)
{
char buffer [20];
switch (padded){
case 4:
sprintf (buffer, "%s:%04d\n", name, value);
break;
}
// lcd2.setCursor(0,3);
// lcd2.print("S:");
// lcd2.print(buffer);
Serial.write (buffer);
}
So this would send altitude:0006 to lua
if string.match(str, "altitude:(%d)") then
state = tonumber(string.match(str, "altitude:(%d)"))
current = ((state*65536)*foot/100)
ipc.writeUD(0x07d4, current )
end
But this isn't setting the correct value, as the plane still shows 00000
If I update the plane it comes up 100 short in my code as well...
value = (value/65536)* foot/100 is the code I use to send to the arduino.
Literally pulling my hair out, and freaking out about the codes for the vertical speed as well.
These are the last two areas that I have left to complete my radio/ap panel.