I build an project for reading temparature and use there fore an
feather huzzah esp 8266 and an hdt 11 sensor use the scketch
esp 8266_basic in the arduino ide compiling an uploading work's ok
than i want to read it in the serial monitor but there i get unreadable tekst
like greece ?? i exspect there an ip number
the baudrates voor board en serial monitor are boht 115200
please can anybody help me but for me a big problem
thanks a lot
cheers wim
We don't charge extra for punctuation here, feel free to sprinkle some throughout your posts in the future.
wimkuijper:
use the scketch
esp 8266_basic in the arduino ide
Where might we find this sketch?
// Import required libraries
#include "ESP8266WiFi.h"
#include <aREST.h>
#include "DHT.h"
// DHT11 sensor pins
#define DHTPIN 5
#define DHTTYPE DHT11
// Create aREST instance
aREST rest = aREST();
// Initialize DHT sensor
DHT dht(DHTPIN, DHTTYPE, 15);
// WiFi parameters
const char* ssid = "wifi-name";
const char* password = "wifi-password";
// The port to listen for incoming TCP connections
#define LISTEN_PORT 80
// Create an instance of the server
WiFiServer server(LISTEN_PORT);
// Variables to be exposed to the API
float temperature;
float humidity;
void setup(void)
{
// Start Serial
Serial.begin(115200);
// Init DHT
dht.begin();
// Init variables and expose them to REST API
rest.variable("temperature",&temperature);
rest.variable("humidity",&humidity);
// Give name and ID to device
rest.set_id("1");
rest.set_name("esp8266");
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
//rest.glow_led();
// Reading temperature and humidity
humidity = dht.readHumidity();
temperature = dht.readTemperature();
// Handle REST calls
WiFiClient client = server.available();
if (!client) {
return;
}
while(!client.available()){
delay(1);
}
rest.handle(client);
}
What happens if you upload this sketch:
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("hello");
delay(1000);
}
in the serial monitor
begin with greece caracters
and then
hello
hello
hello
and so running further
I believe the issue is cause by the output from the ESP8266 bootloader which is at 74880 baud. Unfortunately the debug output on a crash is output at 115200 so there is actually no single baud rate you can set the thing at that won't generate some "Greek" ouput. It's really a frustrating thing to me but I haven't found a solution. Since the bootloader output is less useful to me than the debug output on crash I have decided to run at 115200 and just ignore that initial "Greek" but it certainly seems less professional to have some garbage on every startup.
So now using my simplified test sketch we have determined that you are able to get valid Serial Monitor communication. The next step is to figure out what is going on with your "esp 8266_basic" sketch. When you run it do you get the same single line of "Greek" like you did with my test sketch or does it keep printing "Greek" continuously?
it is the same line of greek by your sketch and than it get over in .......................................................
................... an nothing more wi come so i don't an ip number
wimkuijper:
and than it get over in .......................................................
...................
You didn't think to mention that part before I guess. That's some important information. In the sketch you see the part:
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
That means that until the ESP8266 can connect it just keeps printing ................. So there's some issue there. Are you sure the values of ssid and password you are using are correct for your network?
the ssid and password are ok
also i see an new network is comming in my wifi list
there a see two ip numbers but when i make contact with my browser nothing
happened
wimkuijper:
i see an new network is comming in my wifi list
That sounds like it's creating an access point. Try this:
// Import required libraries
#include "ESP8266WiFi.h"
#include <aREST.h>
#include "DHT.h"
// DHT11 sensor pins
#define DHTPIN 5
#define DHTTYPE DHT11
// Create aREST instance
aREST rest = aREST();
// Initialize DHT sensor
DHT dht(DHTPIN, DHTTYPE, 15);
// WiFi parameters
const char* ssid = "wifi-name";
const char* password = "wifi-password";
// The port to listen for incoming TCP connections
#define LISTEN_PORT 80
// Create an instance of the server
WiFiServer server(LISTEN_PORT);
// Variables to be exposed to the API
float temperature;
float humidity;
void setup(void)
{
// Start Serial
Serial.begin(115200);
Serial.setDebugOutput(true); //enable diagnostic output from WiFi libraries
// Init DHT
dht.begin();
// Init variables and expose them to REST API
rest.variable("temperature", &temperature);
rest.variable("humidity", &humidity);
// Give name and ID to device
rest.set_id("1");
rest.set_name("esp8266");
// Connect to WiFi
WiFi.mode(WIFI_STA); //set to Station mode
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
//rest.glow_led();
// Reading temperature and humidity
humidity = dht.readHumidity();
temperature = dht.readTemperature();
// Handle REST calls
WiFiClient client = server.available();
if (!client) {
return;
}
while (!client.available()) {
delay(1);
}
rest.handle(client);
}
There are two changes:
- Diagnostic output from the WiFi libraries is enabled. This will cause more information to be printed to the Serial Monitor. It's mostly pretty cryptic stuff but maybe you'll be able to get some idea of what's going on from it.
- ESP8266 is explicitly set to Station mode. This means that it will attempt to connect to your WiFi network, rather than creating an access point(AP).
I try this sketch and control it twice
but i get soon compilation terminated. exit status 1
Fout bij het compileren van board adafruit huzzah esp8286
wimkuijper:
but i get soon compilation terminated. exit status 1
Fout bij het compileren van board adafruit huzzah esp8286
That's not enough information for me to help you. When you get an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.
Hello there
i learn how a get the message using code tags
an similate the fault a new problem occur
i don't see my 8266 hazzah board in tools board when i tried there
i get the following fault see attachment
i put this in the additional urls
http://arduino.esp8266.com/stable/ board/package_esp8266com_index.json
and in the second row
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
but i don't get it in the board manager
cheers wim
wimkuijper:
i put this in the additional urls
http://arduino.esp8266.com/stable/ board/package_esp8266com_index.json
That's wrong. It should be:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
The Arduino IDE needs to have access to the internet to be able to download the file. It may be that your firewall or other network security settings are blocking this. Try whitelisting the Arduino IDE(arduino.exe).