Hot answers tagged

4

In plain C, structs are identified by "struc tags", which do not live in the same namespace as type names. Thus, if you declare struct RGB { ... }; a variable of this type should be declared as struct RGB led; In order to avoid the inconvenience of repeatedly typing struct, a common idiom is to define it as a type: typedef struct { ... } RGB; ...


2

Which pin of the ESP8266 chip can be used as I²S output? I uses GPIOs 2, 3, and 15. You only have GPIO2 available, and that's also one half of the UART interface. Also you usually need to generate a "master" clock (usually something like 256x the bit clock) for oversampling. So you can't with that module. Which ESP chip would be the best choice for this ...


2

I have a couple measuring the liquid level of two tanks. The units are distanced from the microcontroller by 12' of 18ga solid-core copper cable. Testing was done with another microcontroller with the sensor attached by 6" cable to ensure accurate readings. That's the longest I needed, so I haven't tested beyond that.


2

You can use Wire.pins(sda, scl); before IMU.begin();. IMU.begin() then calls Wire.begin() without parameters.


1

Doing something as complex as a HTTP request in an interrupt is a very very silly idea. Instead set a flag in the interrupt routine and examine that in the main loop() function to perform your HTTP request.


1

I just found the answer on the following site: https://lastminuteengineers.com/oled-display-arduino-tutorial/ Basically, the method startscroll* on the display takes some arguments. By passing the proper start page and stope page you can scroll parts of the screen. Refer to OLED Memory Map for explanation of the pages on the screen. There are eight pages ...


1

I also had the same issues. I've looked for some posting like here. You can try these codes void loop() { WiFiClient client; Serial.printf("\n[Connecting to %s ... ", host); if (client.connect(host, 80)) { Serial.println("connected]"); Serial.println("[Sending a request]"); client.print(String("GET /") + " HTTP/1.1\r\n" + "Host: " + host +...


1

What you need to do is leave the board connected to your computer and watch the serial monitor to capture the output during the crash. If the board has a true crash it will output a bunch of information which may tell you why you it is crashing. It could be a strings/heap problem or maybe a memory issue since you are declaring a new http object every 5 ...


1

There are 2 errors: you are returning a class type, and not the temp object RGB func(){ RGB temp; return RGB; --> return temp; } To use your typedef you should put the struct "name" after the braced parenthesis: typedef struct { double r; double g; double b; } RGB;


1

The Arduino IDE gives you a massive clue Arduino: 1.8.12 (Windows 10), Board: "Arduino Uno" sketchX:2:2: error: #endif without #if #endif ^~~~~ sketchX:3:10: fatal error: ESP8266WiFi.h: No such file or directory #include <ESP8266WiFi.h> ^~~~~~~~~~~~~~~ compilation terminated. exit status 1 #endif without #if This report would ...


1

The code, that you copied, is made for the Arduino Nano. That is a totally different board with a totally different microcontroller. You cannot simply reuse code for a Nano on an ESP. You need to completely rewrite the code with ESP code. This is the reason, why ports of code for different devices are very rare. You need to fully understand, what the ...


1

The signal of an HC-SR04 is the pulse on the "Echo" wire. The length of that pulse is directly proportionate to the distance from the object. Since cable length does not affect the duration of that pulse, measurement accuracy isn't affected either.


1

The solution to this was nothing to do with WPA2 PSK security or the baud rate being used. In my code I had a space between the WIFI server name and password (me correctly formatting). Apparently the ESP8266 does not like this one bit and the space needs to be removed - like so: //set network SSID and password if esp8266 is activate as station mode else ...


Only top voted, non community-wiki answers of a minimum length are eligible