Air Manager version: 3.7.10
OS: Windows 10.0.19042
I currently have the same hardware working through messagePort, but I'm only sending data from the instrument to the arduino (code here, if you're interested). However, if I try to send data back to the instrument, it never arrives (the print statement in the lua code never fires off). What's odd is that the debug messages do get received successfully.
I'm trying to boil this down to the simplest case where it fails, and I believe this is it:
Air Manager lua code:
Code: Select all
id = hw_message_port_add("ARDUINO_LEONARDO_A", incoming_message_callback)
function incoming_message_callback(message_id, payload)
print("incoming " .. message_id)
end
Code: Select all
#include <si_message_port.hpp>
//init messageport
SiMessagePort* messagePort;
static void new_message_callback(uint16_t message_id, struct SiMessagePortPayload* payload) {
//do nothing for now
}
void setup() {
messagePort = new SiMessagePort(
SI_MESSAGE_PORT_DEVICE_ARDUINO_LEONARDO, //board type
SI_MESSAGE_PORT_CHANNEL_A, //channel
new_message_callback //function to call on message recieve
);
pinMode(30, OUTPUT);
}
void loop() {
static unsigned long previous_time = 0;
unsigned long current_time = millis();
if (current_time > (previous_time + 1000)) {
messagePort->SendMessage(777); //this does not show in the console
messagePort->DebugMessage(SI_MESSAGE_PORT_LOG_LEVEL_DEBUG, "testing, testing"); //this does show in the console
previous_time = current_time;
};
messagePort->Tick();
digitalWrite(30, millis()%1000>500); //flash RX led to indicate loop still running
delay(10);
}
Thanks in advance for your help.