I recently compiled my first sketch, yes I had a lot of help from you guys but I’m taking most of the credit because I brought the chips.
My sketch has run on a NodeMCU perfectly all day and i wondered if I could compile it to run on the tiny ESP-01M(ESP8285). It did, all I need to do now is figure out which pins are the i2c(SDA, SCL) pins.
I have the ESP-01(ESP8285) User Manual but being a complete noob I only see 1 i2c pin(15) and I’ve no idea where to start looking for the other as I tried the “stick it in a hope” trick and that didn’t work. So some pointers please guys, hints and a push in the right direction.
So I could use 12(sda) and 15(scl) as 15 is already scl and as I’ve no idea where sda is and 12 isn’t a special pin as far as I can tell I could that as sda?
Yes but remember 12 and 15 are the pin labels and not GPIO numbers. Don’t know if the IDE for the 8285 will expect GPIO numbers or if the IDE does a translation of the pins etc. Normally it’s best to use GPIO numbers and then your code is portable to other ESP’s.
isn’t working for me.
Get this error(user name supplied by daughter, please dont laugh. )
C:\Users\DooFuss\Desktop\ESP8285_Test\ESP8285_Test.ino: In function 'void setup()':
ESP8285_Test:22: error: expected primary-expression before 'int'
Wire.begin(int sda, int scl)
^
ESP8285_Test:22: error: expected primary-expression before 'int'
Wire.begin(int sda, int scl)
^
ESP8285_Test:23: error: expected ';' before 'Wire'
Wire.begin(12, 14); //Begin the sensor
^
exit status 1
expected primary-expression before 'int'
2 hours I pondered over it, and it was just that simple. Thanks Costas.
So here’s the noob question, what does the “syntax” do. Remove the line from the code and turn it into some sort of instruction?
@doofuss… err I meen @Shadeyman (I know, I laughed… sue me )
Syntax means “arrangement of words, commands, etc.”
But by using // in your sketch before any following text (on that same line), then the compiler ignores it when compiling… it is called ‘commenting’ or ‘commenting out’ and is used for both informative description of commands or functions, for others to understand, or as a quick way of ‘removing’ suspect code while developing, without actually deleting the code from the sketch.
DooFuss was the nickname of a young lad worked for me as a labourer for about 15 years, my daughter married him so I’ll stick with Shadeyman.
I’m sure they’re basically an ESP8266 but with 1Mb of memory built in. And they’re really small, especially for my, I have large hands, probably a consequence of being in construction all my life. Although I am 6 feet 2 and 18 stone so I guess I was never going to have small hands.
I have the User Manual for them, am I allowed/able to up a PDF?
Uploaded the sketch a few times, keep getting this error:
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <Wire.h>
#include <BlynkSimpleEsp8266.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
//Setup connection of the sensor
Adafruit_BME280 bme; // I2C
char auth[] = "3efa4091dxxxxxe454a58ca";
char ssid[] = "xxxxx";
char pass[] = "xxxxx";
BlynkTimer timer;
float pressure; //To store the barometric pressure (Pa)
float temperature; //To store the temperature (oC)
int humidity; //To store the humidity (%) (you can also use it as a float variable)
void setup() {
//Wire.begin(int sda, int scl)
Wire.begin(10, 15); //Begin the sensor
Serial.begin(9600); //Begin serial communication at 9600bps
Serial.println("Adafruit BME280 test:");
Blynk.begin(auth, ssid, pass);
timer.setInterval(2000L, ReadSensors); // read sensor every 5s
}
void ReadSensors(){
//Read values from the sensor:
pressure = bme.readPressure();
temperature = bme.readTemperature();
humidity = bme.readHumidity ();
Blynk.virtualWrite(V1, pressure/100); // write pressure to V1 value display widget
Blynk.virtualWrite(V2, temperature); // write temperature to V2 value display widget
Blynk.virtualWrite(V3, humidity); // write altimeter to V3 value display widget
//Print values to serial monitor:
Serial.print(F("Pressure: "));
Serial.print(pressure);
Serial.print(" Mb");
Serial.print("\t");
Serial.print(("Temp: "));
Serial.print(temperature);
Serial.print(" °C");
Serial.print("\t");
Serial.print("Humidity: ");
Serial.print(humidity); // this should be adjusted to your local forcase
Serial.println(" %");
//delay(2000); //Update every 5 sec
}
void loop() {
Blynk.run();
timer.run();
}
Here’s an ESP8285 in my hand so you can see how small they are. …
Yes, “Generic ESP8285 Module”. I’ve uploaded other sketches to it.
My BME280 sketch for the NodeMCU runs great on it except I’ve no idea which pins are the i2c pins.
I ran i2c Scanner and tried lots of pins but couldn’t find the right ones. So when Costas said I could choose the pins I wanted I was pleased to say the least …