2

When I set my board to 'Generic ESP8266 module' then only A0 pin of arduino is working while all other analog pins are coming out of scope , when I set the board to 'arduino /genuino uno' ,
then "Error compiling for board Arduino/Genuino Uno." this error is coming how to set the board such that all analog pins with ESP8266 will work? [When board is set to Arduino/Genuino Uno

When board is set to Generic ESP8266 module

asked Apr 25, 2019 at 7:19
2
  • 2
    To my knowledge the ESP8266 only has 1 analog input pin, so the others being out of scope is completely correct, because they just don't exist on this board Commented Apr 25, 2019 at 7:25
  • and for what board do you want to compile and upload? Commented Apr 25, 2019 at 7:29

1 Answer 1

1

If you look at the ESP8266 pinout diagram (for example here), you will only find 1 analog input: A0. This is because the ESP8266 simply just has 1 analog input. The Arduino IDE states A1-A5 being out of scope, because on that board these inputs just don't exist. That is completely correct.

Also: When you try to compile code, that is meant for an ESP, for the Arduino Uno board, it will naturally fail, because it is just different hardware. The ESP basis code just cannot run on the Uno.

You will have to compile the code for the board, that you actually want to use AND you can only use codes/libraries, that are meant for your board. You cannot mix them in general. Only some function might be transferable (if so, it will not be easy) and WiFi is definitely not something to transfer to the Uno, which doesn't have the hardware for it.

answered Apr 25, 2019 at 7:33
4
  • thanks for your help, is there any way i can use two analog pins on arduino and use wifi and connect to internet as well Commented Apr 25, 2019 at 7:53
  • You can try to multiplex the one analog pin, by connecting only 1 analog signal at a time to the input (for example switched through a MOSFET by a GPIO pin). You then have to activate that input signal through the code, perform a measurment with the ADC, switch to the second input signal and perform a measurement there too. Depending on what you want to connect to the analog pin, it may also be possible to just power one of the sensors at a time. Commented Apr 25, 2019 at 8:16
  • Or you can instead use an ESP32, which seems to have 2 individual ADCs which many usable pins each. Commented Apr 25, 2019 at 8:17
  • use two analog pins on arduino you were just told the ESP8266 only has one Commented Apr 25, 2019 at 9:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.