Clearly it isn’t identical else it would work seeing as you have proven the demo works. It’s obviously something you are adding so without seeing your code it’s gonna hard to guess. Usual troubleshooting techniques should narrow down the culprit.
Arduino Uno not connecting
Re: Arduino Uno not connecting
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Arduino Uno not connecting
OK after much head scratching, I put some error checking code in which used the serial port, and it is this that was affecting the connection.
Re: Arduino Uno not connecting
I have solved one problem which was the serial port I added to fault find on code, It stops the coms to Airmanager.
The next problem is that if you try and send a message via message port before the connect between Airmanager and Arduino id established , this causes Airmanager not to connect to the Arduino. Is there a way to detect when Airmanager has established a connection with the Arduino?
The next problem is that if you try and send a message via message port before the connect between Airmanager and Arduino id established , this causes Airmanager not to connect to the Arduino. Is there a way to detect when Airmanager has established a connection with the Arduino?
Re: Arduino Uno not connecting
Try the hw_connected() function.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Arduino Uno not connecting
I dont believe that is for the actual connection of the device !, it is for the ancillary items.
@JohnF
The issue seems to be that you are overloading the receive buffer in AM with constant sending which would not happen in real world use (although I haven't seen your code) - if, for example, you comment out one of the test examples in the basic example code, then you will be hammering the output / hence rx buffer which would be unrealistic as in normal use the Arduino would only send code to AM in the case of an event - ie - something changing.
Please try to get into the habit of NEVER using 'delay' etc in Arduino code (or any really )
Try the example below with a single example tx uncommented, but with a delay added - that still allows program execution. This is more akin to Real World.
#include <si_message_port.hpp>
SiMessagePort* messagePort;
// for our delay interval
int interval = 3000;
unsigned long millis_now = 0;
static void new_message_callback(uint16_t message_id, struct SiMessagePortPayload* payload) {
// We received a message from Air Manager or Air Player
}
void setup() {
// Init library on channel A and Arduino type MEGA 2560
messagePort = new SiMessagePort(SI_MESSAGE_PORT_DEVICE_ARDUINO_LEONARDO, SI_MESSAGE_PORT_CHANNEL_C, new_message_callback);
}
void loop() {
// Make sure this function is called regularly
messagePort->Tick();
if(millis() >= millis_now + interval){
millis_now += interval;
// Send a message with id 777 and three bytes payload to the instrument
//uint8_t payload[3] = { 0x00, 0x01, 0x02 };
//messagePort->SendMessage(777, payload, 3);
// There are multiple payload types available (integer, float, byte and string)
messagePort->SendMessage(777, "hello world"); // String
//messagePort->SendMessage(777, (int32_t)-890); // Integer
//messagePort->SendMessage(777, 5.6f); // Float
}
}
Last edited by jph on Mon Jun 14, 2021 9:20 am, edited 1 time in total.
Joe. CISSP, MSc.
Re: Arduino Uno not connecting
@JohnF
John,
you can adjust the 'int interval = value to virtually anything you want to simulate the update of your code TX NOT THE TICK()
For example, the same code based on the above but with a 50mS update for data without effecting tick()
Works fine - Forget that it signs on as Leonardo - that bit is purely a name, the code is the same. You can change it to Mega or Uno etc.
Joe
John,
you can adjust the 'int interval = value to virtually anything you want to simulate the update of your code TX NOT THE TICK()
For example, the same code based on the above but with a 50mS update for data without effecting tick()
Works fine - Forget that it signs on as Leonardo - that bit is purely a name, the code is the same. You can change it to Mega or Uno etc.
It is also important that you do not send a constant non-changing value - for example reading an adc every loop and sending the data regardless of if it has changed or not. ! . the data from Arduino to am only need to be sent WHEN it changes hence your code should look at the incoming data from your connected devices - to the Arduino - and only send when needed. For example, in the case of an ADC input etc, then very small fluctuations can be applied to a filter prior to determining if the value has actually changed in a meaningful manner. Perhaps @Corjan could comment ?#include <si_message_port.hpp>
SiMessagePort* messagePort;
// for our delay interval
int interval = 50;
unsigned long millis_now = 0;
static void new_message_callback(uint16_t message_id, struct SiMessagePortPayload* payload) {
// We received a message from Air Manager or Air Player
}
void setup() {
// Init library on channel A and Arduino type MEGA 2560
messagePort = new SiMessagePort(SI_MESSAGE_PORT_DEVICE_ARDUINO_LEONARDO, SI_MESSAGE_PORT_CHANNEL_C, new_message_callback);
}
void loop() {
// Make sure this function is called regularly
messagePort->Tick();
if(millis() >= millis_now + interval){
millis_now += interval;
// Send a message with id 777 and three bytes payload to the instrument
//uint8_t payload[3] = { 0x00, 0x01, 0x02 };
//messagePort->SendMessage(777, payload, 3);
// There are multiple payload types available (integer, float, byte and string)
messagePort->SendMessage(777, "hello world"); // String
//messagePort->SendMessage(777, (int32_t)-890); // Integer
//messagePort->SendMessage(777, 5.6f); // Float
}
}
Joe
Joe. CISSP, MSc.
Re: Arduino Uno not connecting
If hw_connected() returns true then the device is connected. So yes it can be used to check the connection.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Arduino Uno not connecting
Please define a 'device' in relation to a complete board connection ? (as opposed to looking at individual ancillary connections to the device). That would be informative.
If hw_connected() returns true then the device is connected. So yes it can be used to check the connection.
Joe. CISSP, MSc.
Re: Arduino Uno not connecting
Device is irrelevant in this context. If an individual pin returns as connected then by definition the board must be connected.jph wrote: ↑Mon Jun 14, 2021 10:24 amPlease define a 'device' in relation to a complete board connection ? (as opposed to looking at individual ancillary connections to the device). That would be informative.
If hw_connected() returns true then the device is connected. So yes it can be used to check the connection.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Arduino Uno not connecting
I Have that bit working now, Thanks.