I am currently using the Arduino Yun to send a string data into my Microsoft Azure Mobile Services back-end tables. The coding work fine and the Serial Monitor can shown the data is sending out but there was no any update in my Microsoft Azure Mobile Service tables. Below is the coding for my program. Can anyone please help me to check out the problem? Appreciate your help.
void wait_response()
{
while (!client.available()) {
if (!client.connected()) {
return;
}
}
}
/*
** Read the response and dump to serial
*/
void read_response()
{
bool print = true;
while (client.available()) {
char c = client.read();
// Print only until the first carriage return
if (c == '\n')
print = false;
if (print)
Serial.print(c);
}
}
void wait_response()
{
while (!client.available()) {
if (!client.connected()) {
return;
}
}
}
Change to :
void wait_response()
{
while (!client.available()) {
}
}
ALSO you probably don't want to break the code up that way.
Typically, you want to keep a transaction in a single code block. If you want to break it into subroutines, then make sure those subroutines are functional (and general purpose); otherwise your code will become unmaintainable.
I also noticed something you want to avoid. In the code block below you are using the word print. You want to avoid using keywords or functions names or names of methods, since it is easy to get confused when reading this. You could change print to shouldIprint or prnt, anything that does not look too close to something in the library.
void read_response()
{
bool print = true;
while (client.available()) {
char c = client.read();
// Print only until the first carriage return
if (c == '\n')
print = false;
if (print)
Serial.print(c);
}
}