Pin mapping

mistergreen
Posts: 10
Joined: Tue Jan 23, 2018 4:56 pm

Pin mapping

Postby mistergreen » Sat Feb 03, 2018 8:26 pm

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?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Pin mapping

Postby WiFive » Sun Feb 04, 2018 4:37 am

It should work except 34-39.

mistergreen
Posts: 10
Joined: Tue Jan 23, 2018 4:56 pm

Re: Pin mapping

Postby mistergreen » Sun Feb 04, 2018 3:12 pm

Ah thanks. That worked. Just curious why not pin 34-39?

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: Pin mapping

Postby rudi ;-) » Sun Feb 04, 2018 9:11 pm

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 ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: Majestic-12 [Bot] and 76 guests