i'am a newbie and need help
#include <esp8266wifimulti.h>
#include <esp8266httpclient.h>
esp8266wifimulti wifimulti;
void setup()
{
serial.begin(115200);
// set wifi ssid , password
wifimulti.addap("ssid", "password");
}
void loop()
{
//wait wifi connection
if((wifimulti.run() == wl_connected))
{
httpclient http;
//change url api last feed
http.begin("http://http://agnosthings.com/c2e7facc-d278-11e6-8001-005056805279/feed?push=switch");
//mulai koneksi dan ambil http header
int httpcode = http.get();
//httpcode negatif if error
if(httpcode > 0)
{
//print httpcode serial
serial.printf("[http] get... code: %d\n", httpcode);
//if value server accepted
if(httpcode == http_code_ok)
{
//print string json server
string json = http.getstring();
serial.println(json);
}
} else {
serial.printf("[http] get... failed, error: %s\n", http.errortostring(httpcode).c_str());
}
//tutup koneksi http
http.end();
}
delay(5000);
}
and got error in if((wifimulti.run() == wl_connected)), , use wemos d1 mini in arduino can't change port. please me.
#include <esp8266httpclient.h>
esp8266wifimulti wifimulti;
void setup()
{
serial.begin(115200);
// set wifi ssid , password
wifimulti.addap("ssid", "password");
}
void loop()
{
//wait wifi connection
if((wifimulti.run() == wl_connected))
{
httpclient http;
//change url api last feed
http.begin("http://http://agnosthings.com/c2e7facc-d278-11e6-8001-005056805279/feed?push=switch");
//mulai koneksi dan ambil http header
int httpcode = http.get();
//httpcode negatif if error
if(httpcode > 0)
{
//print httpcode serial
serial.printf("[http] get... code: %d\n", httpcode);
//if value server accepted
if(httpcode == http_code_ok)
{
//print string json server
string json = http.getstring();
serial.println(json);
}
} else {
serial.printf("[http] get... failed, error: %s\n", http.errortostring(httpcode).c_str());
}
//tutup koneksi http
http.end();
}
delay(5000);
}
and got error in if((wifimulti.run() == wl_connected)), , use wemos d1 mini in arduino can't change port. please me.
quote
and got error in if((wifimulti.run() == wl_connected))what error?
code: [select]
http.begin("http://http://agnosthings.com/c2e7facc-d278-11e6-8001-005056805279/feed?push=switch");
what f**king nonsense? hare ever seen address include http:// twice?
Arduino Forum > Using Arduino > Programming Questions > i'am a newbie and need help
arduino
Comments
Post a Comment