#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
ESP8266WiFiMulti WiFiMulti;
void setup()
{
Serial.begin(115200);
// set WiFi SSID and password
WiFiMulti.addAP(“SSID”, “Password”);
}
void loop()
{
//wait WiFi connection
if((WiFIMulti.run() == WL_CONNECTED))
{
HTTPClient http;
//change with 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 will be negatif if error
if(httpCode > 0)
{
//print httpCode to serial
Serial.printf("[HTTP] GET… code: %d\n", httpCode);
//if value from server accepted
if(httpCode == HTTP_CODE_OK)
{
//print string json from 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 i got error in if((WiFIMulti.run() == WL_CONNECTED)), and i use wemos D1 mini but in my arduino i can’t change the port. please help me.
system
January 4, 2017, 2:19pm
#2
and i got error in if((WiFIMulti.run() == WL_CONNECTED))
What error?
http.begin("http://http://agnosthings.com/c2e7facc-d278-11e6-8001-005056805279/feed?push=switch");
What is that f**king nonsense? Hare you EVER seen an address that include http:// twice?
Arduino: 1.6.13 (Windows 7), Board: "WeMos D1 R2 & mini, 80 MHz, 115200, 4M (1M SPIFFS)"
Build options changed, rebuilding all
C:\Users\Administrator\Documents\Arduino\sketch_jan04aa\sketch_jan04aa.ino: In function 'void loop()':
sketch_jan04aa:17: error: 'WiFIMulti' was not declared in this scope
if ((WiFIMulti.run() == WL_CONNECTED))
^
sketch_jan04aa:38: error: 'serial' was not declared in this scope
serial.println(json);
^
exit status 1
'WiFIMulti' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
this errors, what's that mean? i'am a newbie sir and this is my firts time using arduino
system
January 4, 2017, 2:27pm
#4
'WiFIMulti' was not declared in this scope
But, I'll bet that WiFiMulti was... Case matters.
sketch_jan04aa:38: error: 'serial' was not declared in this scope
But, I'll bet that Serial was... Case matters.
and what must i do when i can’t choose the port mr.PaulS?
system
January 4, 2017, 2:59pm
#6
kresnamurti:
and what must i do when i can't choose the port mr.PaulS?
Well, I really don't understand what "choose the port" means, out of context, so I really can't help you.
Arduino: 1.6.13 (Windows 7), Board: "WeMos D1 R2 & mini, 80 MHz, 115200, 4M (1M SPIFFS)"
Sketch uses 239,033 bytes (22%) of program storage space. Maximum is 1,044,464 bytes.
Global variables use 32,496 bytes (39%) of dynamic memory, leaving 49,424 bytes for local variables. Maximum is 81,920 bytes.
error: Failed to open COM1
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_open failed
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
what this means Mr.PaulS?
system
January 4, 2017, 3:26pm
#8
what this means Mr.PaulS?
What it means is that you need to stop the IDE, unplug the not-an-Arduino from the PC, start the IDE, and select Tools + Port. Make a list of the COM ports that are shown.
Stop the IDE, plug the not-an-Arduino back in, and start the IDE again. Select Tools + Port again. The not-an-Arduino is connected to the port that is in the list the second time that is not in the list the first time.
thats the problem, i can't choose port from tools
I think that board needs CH340 USB drivers. Did you install them?
Lots of info if you google
errrr no, i'am not installed that
It's a common mistake, don't worry