Hi @orbitcoms - If you look at the hologram_cloud example sketch, you’ll find an example of how to send data from our Dashboard or API inbound to the Dash’s inbound message handler. In the example, 4444 is set as the listening TCP socket port.
I cannot see how this works in the example link you provided. That sketch is processing SMS data received.
The code I was using is one of the examples “Hologram Dash hello world” that installed with the library. It does not use SMS. I can enter text using terminal program and the text gets to my dashboard in cloud ok but I cannot receive any data back from cloud when I send a message.
P.S. If you’re in the Arduino IDE go to File->Examples->Dash Examples->hologram_dash_cloud and you can see more of how this is used. That file on github is supposed to have it but it’s outdated. We’ll update that soon.
I managed to get the system receiving messages using the example code. I get “Ok” back on cloud in response.
However, I am having some issue with printing the received message. When I add a line to print the received message I get “Socket error: [Errno 111] Connection refused” instead of the “OK”. If I comment out my print line it is ok again.
Here is my code for the received message handler. Thanks again.
void cloud_inbound(int length) {
buffer_inbound[length] = 0; //NULL terminate the data for printing as a String
HologramCloud.sendMessage(buffer_inbound, “inbound”);
SerialUSB.println(buffer_inbound);
}
Ah I think I see the issue. At the moment, I don’t think the firmware supports changing that response value so you’ll always get an OK in the immediate response packet. What’s going on here is when you call sendMessage in that handler it actually disconnects that TCP stream you were listening on and then sends a new stream to our cloud.
The way to do this is probably to set a flag that gets used in your main loop and causes it to send the buffer to the cloud from there. Something like this:
The problem is not the response, The problem is that I want to print our the received message to the serial port but when I add the line to print it affects the response error.
Or would I be better to set another flag like “receivedCloudMessage = true”
Then in my mainline code
if(receivedCloudMessage){
//print out buffer_inbound
}
Ah ok, then yes, that example should also work. I’m not sure why printing from within that handler is causing issues. We’ll do some investigation on our end.
Huh, I hear that comment a lot about my “interesting applications” when I am familiarizing myself with new devices.
Maybe due to inexperience my approach is not conventional? Or others are not doing these sort of projects, or if they are then they figure it out themselves without needing to ask?
I am not afraid to ask silly questions, it is how I get to understand things in terms that make sense to me.