You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int val;
val = analogRead(SensorIn1);
Serial.println(val);
// Post to Google Form.............................................
if (client.connect(server, 80))
{
k=0;
Serial.println("connected");
sprintf(postmsg,"GET /pushingbox?devid=%c&status=%d HTTP/1.1",devid,val);
client.println(postmsg);
client.println("Host: api.pushingbox.com");
client.println("Connection: close");
client.println();
if (!client.connected())
{
Serial.println();
Serial.println("disconnecting.");
client.stop();
k==1;
return;
}
}
The output I receive is
connecting....
456
disconnecting.
563
disconnecting.
and so on..
I have tried using different servers and accordingly selected the port numbers (eg 80, 443 etc) but the it never connects to the server. Kindly help.
From @piyali1988 on January 3, 2015 0:6
client.connect(server, 80); is not working. Here is the code:
include <SPI.h>
include <WiFi.h>
include <WiFiClient.h>
include <WiFiServer.h>
undef int
undef abs
undef double
undef float
undef round
int SensorIn1 = 1;
int led_pin = 13;
char devid[] = "v90EC98310145483";
int del=100; // Amount of seconds delay between posting to google docs.
char postmsg[100];
int k=0;
int temp_av = 0;
char server[] = "api.pushingbox.com";
char ssid[] = "**_";
char pass[] = "_";
WiFiClient client;
void setup()
{
Serial.begin(9600);
WiFi.begin(ssid, pass);
delay(1000);
Serial.println("connecting...");
}
void loop(){
// Post to Google Form.............................................
if (client.connect(server, 80))
{
k=0;
Serial.println("connected");
sprintf(postmsg,"GET /pushingbox?devid=%c&status=%d HTTP/1.1",devid,val);
client.println(postmsg);
client.println("Host: api.pushingbox.com");
client.println("Connection: close");
client.println();
}
delay(1000);
if (!client.connected())
{
Serial.println();
Serial.println("disconnecting.");
client.stop();
k==1;
return;
}
}
The output I receive is
connecting....
456
disconnecting.
563
disconnecting.
and so on..
I have tried using different servers and accordingly selected the port numbers (eg 80, 443 etc) but the it never connects to the server. Kindly help.
Copied from original issue: arduino/Arduino#2531
The text was updated successfully, but these errors were encountered: