Having difficulty setting ESP32 Thing (DEV-13907) GPIO pins as digital OUTPUT

Hello,

I am stumped.. On Sparkfun ESP32 Thing (DEV-13907) GPIO PINS 13,12,14,27,26,25 I am unable to change the state from "0" to "1" when setting pins as digital outputs using pinMode(pin, OUTPUT).

It works perfectly for pins 21,22,19,23,17,16.

Anyone on this forum familiar with ESP32 THING and had this situation occur?

According to data sheet any pin labeled GPIO can be used as digital OUTPUT with exception to those labeled *GPIO (port input only). Does ADC take precedence?

My code produces the following output:

Pin: 25 digitalRead: 0 analogRead: 4095
Pin: 26 digitalRead: 0 analogRead: 4095
Pin: 27 digitalRead: 0 analogRead: 4095
Pin: 14 digitalRead: 0 analogRead: 4095
Pin: 12 digitalRead: 0 analogRead: 4095
Pin: 13 digitalRead: 0 analogRead: 4095
*** CONTROL PINS INITIALZED pinMode OUTPUT
*** digtalWrite HIGH digitalRead: 1 ***
Pin: 25 digitalRead: 0 analogRead: 4095
Pin: 26 digitalRead: 0 analogRead: 4095
Pin: 27 digitalRead: 0 analogRead: 4095
Pin: 14 digitalRead: 0 analogRead: 4095
Pin: 12 digitalRead: 0 analogRead: 4095
Pin: 13 digitalRead: 0 analogRead: 4095
*** digtalWrite LOW digitalRead: 0 ***
Pin: 25 digitalRead: 0 analogRead: 4095
Pin: 26 digitalRead: 0 analogRead: 4095
Pin: 27 digitalRead: 0 analogRead: 4095
Pin: 14 digitalRead: 0 analogRead: 4095
Pin: 12 digitalRead: 0 analogRead: 4095
Pin: 13 digitalRead: 0 analogRead: 4095
... end debug 2

// GLOBAL VARIABLES   
   /*/  bluePin1 = unassigned (LED) // [1]   /*/
   int orangePin = 25; // [2]
   int blackPin = 14;   // [3]
   /*/ redPin4 = unassigned (LED) //+ [4] /*/    
   int greenPin = 26;  // [5]
   int yellowPin = 27; // [6] 
   int brownPin = 13; // [7]
   int grayPin = 12;   // [8]

void setup() {

//*** GPIO CTRL pins *** 
  pinMode(orangePin, OUTPUT);// ON/OFF
  pinMode(greenPin, OUTPUT);// LEFT QUAD
  pinMode(yellowPin, OUTPUT);// RIGHT QUQAD
  pinMode(blackPin, OUTPUT);// RIGHT STEP
  pinMode(grayPin, OUTPUT);// LEFT STEP 
  pinMode(brownPin, OUTPUT); // DECREASE L/R 

     digitalWrite(orangePin, LOW);
     getPinVal(orangePin);// ON/OFF
   Serial.println(" ");
     digitalWrite(greenPin, LOW);
     getPinVal(greenPin);// LEFT QUAD
  Serial.println(" ");
     digitalWrite(yellowPin, LOW);
     getPinVal(yellowPin);// RIGHT QUAD
  Serial.println(" ");
     digitalWrite(blackPin, LOW);
     getPinVal(blackPin);// RIGHT STEP 
  Serial.println(" ");
     digitalWrite(grayPin, LOW);
     getPinVal(grayPin);// LEFT STEP
  Serial.println(" ");
     digitalWrite(brownPin, LOW);
     getPinVal(brownPin);// DECREASE L&R QUADS GLUTES
  Serial.println(" ");



  Serial.println("*** CONTROL PINS INITIALZED pinMode OUTPUT");  
  
  int debug = 2;

   if(debug == 2) {
      digitalWrite(orangePin, HIGH);
      digitalWrite(greenPin, HIGH);
      digitalWrite(yellowPin, HIGH);
      digitalWrite(grayPin, HIGH);
      digitalWrite(blackPin, HIGH);
      digitalWrite(brownPin, HIGH);

      Serial.println("*** digtalWrite HIGH digitalRead: 1 ***"); 
   
     getPinVal(orangePin);// ON/OFF
  Serial.println(" ");
     getPinVal(greenPin);// LEFT QUAD
  Serial.println(" ");
     getPinVal(yellowPin);// RIGHT QUAD
  Serial.println(" ");
     getPinVal(blackPin);// RIGHT STEP 
  Serial.println(" ");
     getPinVal(grayPin);// LEFT STEP
  Serial.println(" ");
     getPinVal(brownPin);// DECREASE L&R QUADS GLUTES
  Serial.println(" ");

      digitalWrite(orangePin, LOW);
      digitalWrite(greenPin, LOW);
      digitalWrite(yellowPin, LOW);
      digitalWrite(grayPin, LOW);
      digitalWrite(blackPin, LOW);
      digitalWrite(brownPin, LOW);

     Serial.println("*** digtalWrite LOW digitalRead: 0 ***"); 

     getPinVal(orangePin);// ON/OFF
     Serial.println(" ");
     getPinVal(greenPin);// LEFT QUAD
     Serial.println(" ");
     getPinVal(yellowPin);// RIGHT QUAD
     Serial.println(" ");
     getPinVal(blackPin);// RIGHT STEP 
     Serial.println(" ");
     getPinVal(grayPin);// LEFT STEP
     Serial.println(" ");
     getPinVal(brownPin);// DECREASE L&R QUADS GLUTES
     Serial.println(" ");
     
  Serial.println("... end debug 2 ");
  
}//end debug 2


}/* end void setup */
/*/============= END MAIN SETUP =========/*/


/*/========== BEGIN MAIN LOOP ============/*/ 
void loop() {


} //end main loop
/*/================= END MAIN LOOP ==========/*/



//============================//
// *** function: getPinVal ***// 
//============================//
void getPinVal(int inputPin) {
 int dval = 0;
 int sval = 0;
  Serial.print(" Pin: ");
  Serial.print(inputPin);
  // get analog values from pins)
  sval = analogRead(inputPin);
  dval = digitalRead(inputPin);
  Serial.print(" digitalRead: ");
  Serial.print(dval);
  Serial.print(" analogRead: ");
  Serial.print(sval);
//  Serial.println("");
// return dval;
} //end fuction: getPinVal
//------------------------

Any assistance would be appreciated. Thanks in advance.

Have you tried the "D" designations, e.g. D25, D26, D27... ?

I have not tried D designation. I will try this and report back. Thanks!

UPDATE…

compiler did not like that… I can’t find any example for “D” designation.

Arduino: 1.8.12 (Windows 7), Board: “ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None”

sketch_apr17_THING_V3:57:20: error: ‘D25’ was not declared in this scope

int orangePin = D25; // [2] 25

^

‘D25’ was not declared in this scope