Page 1 of 1

Pin mapping

Posted: Sat Feb 03, 2018 8:26 pm
by mistergreen
On the Arduino you can pin map like so

Code: Select all

pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);
Since there are so many analog input pins, it would be good to convert it to a digital pin. I've tried this but it doesn't work for the ESP32.
Is this still in the works or it isn't possible?

Re: Pin mapping

Posted: Sun Feb 04, 2018 4:37 am
by WiFive
It should work except 34-39.

Re: Pin mapping

Posted: Sun Feb 04, 2018 3:12 pm
by mistergreen
Ah thanks. That worked. Just curious why not pin 34-39?

Re: Pin mapping

Posted: Sun Feb 04, 2018 9:11 pm
by rudi ;-)
mistergreen wrote:On the Arduino you can pin map like so

Code: Select all

pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);
Since there are so many analog input pins, it would be good to convert it to a digital pin. I've tried this but it doesn't work for the ESP32.
Is this still in the works or it isn't possible?
if you use the right board, it os possible, some boards 37,38 is not breakout for reason

do you want use it as OUTPUT digital or INPUT digital?
some pins need extra knowledge example 37,38
but this is done in the arduino ide

example was:

Code: Select all

#include <driver/adc.h>

void setup() { 
 Serial.begin(115200);
 adc1_config_width(ADC_WIDTH_12Bit);
 adc1_config_channel_atten(ADC1_CHANNEL_1, ADC_ATTEN_6db);//channel_1 for GPIO37 and 2 for 38.
}

void loop() {
 int value = adc1_get_voltage(ADC1_CHANNEL_1);
 Serial.println(value);
 delay(1000);
} 
note, that 37,38 have exta HDK Low-Noise Amplifier in this version under 28.4 ( can be changed in next version )
Image

best wishes
rudi ;-)