Can anyone help me debug this? Pretty simple code. I want it to turn on the onboard LED when the SAS button is pressed. At the moment it does not do this. (The example files work however :))
#include "KerbalSimpit.h"
KerbalSimpit mySimpit(Serial);
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
while (!mySimpit.init()) {
delay(100);
}
digitalWrite(LED_BUILTIN, LOW);
mySimpit.inboundHandler(messageHandler);
}
void loop() {
mySimpit.update();
}
void messageHandler(byte messageType, byte msg[], byte msgSize) {
byte actions = msg[0];
if (messageType == ACTIONSTATUS_MESSAGE) {
if (actions & SAS_ACTION) {
digitalWrite(LED_BUILTIN, HIGH);
}
}
}
Edit ** Solved