Hi.
I am just wondering if anybody can help me with this problem that is driving me crazy! Thank god I have a tough book!
Anyway, I am new to arduino and I have been having a little play with arduino nanos, esp32 and wemos d1 minis over the last few months trying to get familiar with them. I have been getting on fine up to last Monday.
The problem is that I can’t upload or verify any sketch without getting the message “error compiling to board …” i have tried every board type in the list and I always get this message when I click verify or upload (currently trying to upload to d1 mini).
From when it worked to not working I changed no settings.
Also on the list of boards, a lot have mysteriously gone missing even though the correct url is in the board manager.
Another thing is that the url for the esp32 keeps going missing even though I am putting a comma after the previous url. Has there been a update that has messed everything up?
I really hope someone can help me before I get the hammer out.
Thanks.
What version of the IDE and the ESP8266 and ESP32 Cores are you running?
Is your laptop short on disk space?
Pete.
Hi Pete!
i deleted the ide on my computer and re installed it and it is now working, but now have a new problem.
i am trying to read a dht11 sensor on a D1 mini using blynk and i am not receiving any values. i have allocated the correct virtual pins to the gauges (V5 and V6). could you help?
here is the code:
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MD1txRhHd0K22JHTdbnzRxTPZapr6-OY";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "VM6063118";
char pass[] = "Hr5hvkfg9rmw";
#define DHTPIN 2 // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
dht.begin();
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
}
@Markp333 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
Pete.
Your timer isn’t being called, because you don’t have timer.run();
in your void loop.
Also, DHT11s are very slow, and it’s best not to query them more than once every 5 seconds.
Pete.
Pete you are a absolute legend!
thank you so much for your help. where is good to go online for tutorials?
i am trying to add a mq135 to the sketch to read in blynk. how do i go about that? ive tried to find info on adding sensors in a sketch but i havnt come across anything that helps.
mark
There are a few topics about the MQ135 on this forum.
As a general rule. It’s best to get the sketch working and printing values to the serial monitor rather than Blynk to begin with.
Many code examples from the internet will put the code to read the sensor and display the results in the void loop, which won’t work with Blynk.
You could either add the code into your sendSensor function, or have another similar function which is called by another timer.
Pete.
Hi Pete.
i have finally got it working. now to try and work out how to add a PIR.
the help was much appreciated!
Mark.
Well done.
With the PIR, once again there are many examples here. There are basically two approaches:
A) keep checking (polling) the digital pin using a timer to see if the PIR has triggered. This is a sort of “are we there yet” approach.
B) attach an interruption to the digital pin so that the MCU will take care of monitoring the pin for a change of state.
The polling method is easier. The interrupt is what a purist would do, and is a bit more advanced.
Pete.