// ESP32 Technical Reference Manual Version 4.2 // // 5.3.3 Simple GPIO Output // // The GPIO Matrix can also be used for simple GPIO output – // setting a bit in the GPIO_OUT_DATA register will // write to the corresponding GPIO pad. // To configure a pad as simple GPIO output, the GPIO Matrix GPIO_FUNCx_OUT_SEL // register is configured with a special peripheral index value (0x100). //--------------------------------------------------------------------------------- void setup() { // pinMode(2, OUTPUT); // pinMode(13,OUTPUT); REG_WRITE(GPIO_ENABLE_REG, BIT2); //Define GPIO2 as output REG_WRITE(GPIO_FUNC2_OUT_SEL_CFG_REG, 0x100); //Special peripheral index value (0x100) //REG_WRITE(GPIO_ENABLE_REG, BIT13); //Define GPIO13 as output //REG_WRITE(GPIO_FUNC13_OUT_SEL_CFG_REG, 0x100); //Special peripheral index value (0x100) } //--------------------------------------------------------------------------------- void loop() { REG_WRITE(GPIO_OUT_W1TS_REG, BIT2); //GPIO2 HIGH (set) REG_WRITE(GPIO_OUT_W1TS_REG, BIT13); //GPIO13 HIGH (set) delay(50); REG_WRITE(GPIO_OUT_W1TC_REG, BIT2); //GPIO2 LOW (clear) REG_WRITE(GPIO_OUT_W1TS_REG, BIT13); //GPIO13 LOW (clear) delay(50); }