Hi Newbie here! Needing help with a error message. Would love your help! Cheers!

Hey guys im new to this whole community! First time setting something up like this. I have a problem with my code and can’t seem to solve it. So i want to set up my arduino to show my the price of the bitcoin. Thanks so much for the help so far!!
The problem is that i am getting an error message, this one to be exact: (Under it will be the whole code)

Arduino: 1.8.5 (Mac OS X), Board: “WEMOS LOLIN32, 80MHz, 921600”

/Users/********/Documents/Arduino/sketch_dec07a/sketch_dec07a.ino:3:30: fatal error: ESP8266WebServer.h: No such file or directory
compilation terminated.
Multiple libraries were found for “WiFi.h”
Used: /Users/reneedupreez/Documents/Arduino/hardware/espressif/esp32/libraries/WiFi
Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
Error compiling for board WEMOS LOLIN32.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Full code:

#include <WiFi.h>
include <WiFiClient.h>

include <ESP8266WebServer.h>

include <Wire.h>

include "SSD1306.h"

include <WebServer.h>

// pins
define SDA 5

define SCL 4

define I2C 0x3C

// create display SSD1306 display(I2C, SDA, SCL);
// wifi settings const char* host = "api.coindesk.com"; const char* ssid = "PUT YOUR SSID HERE"; // REPLACE THIS TO YOUR WIFI SETTINGS const char* password = "PUT YOUR PASSWORD HERE"; // Ditto
//ESP8266WebServer server(80); WebServer server ( 80 ); void handle_root() { server.send(200, "text/plain", "Hello from the esp32"); delay(100); }
void setup() { Serial.begin(115200); delay(100);
display.init(); display.flipScreenVertically(); display.clear(); display.display();
Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP());
server.on("/", handle_root);
server.begin(); Serial.println("HTTP server started"); }
void loop() { server.handleClient();
display.clear(); display.setFont(ArialMT_Plain_24); display.drawString(8, 20, "Updating ..."); display.display();
// Connect to API Serial.print("connecting to "); Serial.println(host);
// Use WiFiClient class to create TCP connections WiFiClient client; const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; }
// We now create a URI for the request String url = "/v1/bpi/currentprice.json";
Serial.print("Requesting URL: "); Serial.println(url);
// This will send the request to the server client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n"); delay(100);
// Read all the lines of the reply from server and print them to Serial String answer; while(client.connected()){ String line = client.readStringUntil('\r'); answer += line; }
client.stop(); Serial.println(); Serial.println("closing connection");
// Process answer Serial.println(); Serial.println("Answer: "); Serial.println(answer);
// Convert to JSON String jsonAnswer; int jsonIndex;
for (int i = 0; i < answer.length(); i++) { if (answer[i] == '{') { jsonIndex = i; break; } }
// Get JSON data jsonAnswer = answer.substring(jsonIndex); Serial.println(); Serial.println("JSON answer: "); Serial.println(jsonAnswer); jsonAnswer.trim();
// Get rate as float int rateIndex = jsonAnswer.indexOf("rate_float"); String priceString = jsonAnswer.substring(rateIndex + 12, rateIndex + 18); priceString.trim(); float price = priceString.toFloat();
// Print price Serial.println(); Serial.println("Bitcoin price: "); Serial.println(price);
// Display on OLED display.clear(); display.setFont(ArialMT_Plain_16); display.drawString(32, 0, "BTC Price:"); display.setFont(ArialMT_Plain_24); display.drawString(32, 20, priceString); display.drawString(6, 20, "$"); display.setFont(ArialMT_Plain_16); display.drawString(32, 44, "Awh Yeah"); display.display();
// Wait 15 seconds delay(15000); }

You're trying to use an ESP8266 library with an ESP32 board. The ESP32 hardware package does not contain a library named ESP8266WebServer.h, thus the error. I'm doubtful that even if you did have that library installed whether it would work with the ESP32 since it's written for ESP8266. You will probably need to either modify your code to use ESP32 compatible libraries or use an ESP8266 board.

Really? That weird I got this code of somebody that built it specifically for ESP 32. So is it easy for me to change that?

Are you sure it wasn't ESP8266 they built it for?

It looks like indeed the ESP8266WebServer library from the ESP8266 core for Arduino is not compatible with ESP32, however there are efforts to make it so, which you can read about here, and maybe grab a beta version of the library:

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

Aaaah my bad! I think i have spot the problem now. Instead of using just the ESP32 i should use the ESP8266/ESP32 WebServer library. I have downloaded this. Is this now easy to put in, and if so do you mind explaining or linking me to somewhere that explains?

"Assuming the esp32 board is installed in the arduino ide. Set to WEMOS LOLIN32.
Using the Oled Driver from library manager "ESP8266 and ESP32 Oled Driver for SSD1306 display"
***Using the Webserver.h library from GitHub - bbx10/WebServer_tng: ESP8266/ESP32 WebServer
Just copy and paste the code below into the Arduino IDE and make sure the libraries are already installed
The built in oled is already SDA gpio5 and SCL gpio4 so you can change that to an external oled if needed."

These were the instructions!

After that hopefully the sketch will compile.

Now it is giving me this. Thank you so much for all the help so far!

/Documents/Arduino/sketch_dec07a/sketch_dec07a.ino:5:21: fatal error: SSD1306.h: No such file or directory
compilation terminated.

You need to do a similar process as I described above but with the SSD1306 library. Did they also provide a link to that library in the instructions for the sketch?

No, sadly not! Isn't it included in that other library file though?

I now also see that my "arduino" file is in documents, this is where the arduino app is making all its changes. Is this okay? will it effect anything?

I added the Library now i get this:

Documents/Arduino/hardware/espressif/esp32/tools/sdk/include/newlib" "-Documents/Arduino/sketch_dec07a/sketch_dec07a.ino:1:30: fatal error: Adafruit_SSD1306.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board WEMOS LOLIN32.

Isn’t it included in that other library file though?

Nope. Those files have two completely different purposes so it would make no sense to put them in the same library.

I now also see that my “arduino” file is in documents, this is where the arduino app is making all its changes.

Do you mean your sketch (that’s the name for .ino files)? You can save it wherever you like. If /Documents/Arduino/sketch_dec07a is convenient then go with it. Otherwise you can save it somewhere else. The Arduino IDE allows you to select a “sketchbook” folder at File > Preferences > Sketchbook location. Sketches stored in that folder will appear under the File > Sketchbook menu, which makes them convenient to open, but you can always do a File > Open or just open .ino files directly from any location on your computer.

I added the Library now i get this:

Documents/Arduino/hardware/espressif/esp32/tools/sdk/include/newlib" "-Documents/Arduino/sketch_dec07a/sketch_dec07a.ino:1:30: fatal error: Adafruit_SSD1306.h: No such file or directory

Install the library that contains Adafruit_SSD1306.h, as you did the other two.