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
-
2To 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 boardchrisl– chrisl2019年04月25日 07:25:40 +00:00Commented Apr 25, 2019 at 7:25
-
and for what board do you want to compile and upload?Juraj– Juraj ♦2019年04月25日 07:29:03 +00:00Commented Apr 25, 2019 at 7:29
1 Answer 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.
-
thanks for your help, is there any way i can use two analog pins on arduino and use wifi and connect to internet as wellLakhan Malviya– Lakhan Malviya2019年04月25日 07:53:37 +00:00Commented 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.chrisl– chrisl2019年04月25日 08:16:12 +00:00Commented 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.chrisl– chrisl2019年04月25日 08:17:37 +00:00Commented Apr 25, 2019 at 8:17
-
use two analog pins on arduino
you were just told the ESP8266 only has oneJaromanda X– Jaromanda X2019年04月25日 09:48:37 +00:00Commented Apr 25, 2019 at 9:48