I am working on a project to send sensor values from esp8266's Wemos D1 mini to MySQL. I tried using the library MySQLconnection.h but I couldn't make it to connect to wifi. So I uploaded a simple program to connect the board to WiFi using ESP8266.h but I got the error that Unable to compile for Wemos D1 board.

Please tell me the right procedure to select the right library for the problem defined.

  • are you trying to program the ESP or an AVR connected to an ESP? if ESP directly, modify the examples to get started, they are well-documented and easy to adjust.
    – dandavis
    Aug 29 '18 at 15:54
  • gist.github.com/pudelosha/5a42092bbcf0bfc9ddab20e6093e68b7 is a good example that might help you. Aug 29 '18 at 15:54
  • see examples in IDE File menu. the ESP8266WiFi library. ESP8266.h is an empty library that exists only for included examples.
    – Juraj
    Aug 29 '18 at 17:22

You should break your problem down into simple parts, which it seems you are on-track to do. Your ultimate goal appears to break down into the following sub-tasks (not in order):

  1. Read sensor value
  2. Connect to a WiFi network
  3. Connect to a MySQL server
  4. Send sensor data to MySQL database

You are unlikely to find a single library to do all of these tasks, but as progress in solving each step, any library that works is the "Right" one, in general. Choose a library that solves an individual task.

You say you tried to upload a simple program to only connect to WiFi, but that it did not compile. The clue to why it did not compile will be found in the actual compile error message. If you can update your question with the error message and the code to the simple program, you can get some guidance from the users of this site to solve that problem.

  • Okay, I will follow the above methodology. But what I wanted to know is that whether Arduino website provides a systematic approach to select libraries in their website (Although I didn't find anything there). Means that instead of googling the library, a more reliable way to do it. Aug 29 '18 at 18:11
  • I find the Arduino website to not be a good source of "what's available" for external libraries. The ones that are documented are often under-documented. Aug 29 '18 at 18:14
  • Ok, cool. Btw I just reuploaded the simple ESP8266 program and it worked. Thank you for suggestions. Aug 29 '18 at 18:28
  • But how can I know what are all the functions, objects available in a library? Aug 29 '18 at 18:45
  • 1
    Typically the best way is to find and read the source code of the library. Aug 29 '18 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.