When I run this code (only enough code to show the problem) as is sensorVal does not print. Instead I get this in monitor, over and over, with no delay;
ets Jul 29 2019 12:21:46
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1448
load:0x40078000,len:14844
ho 0 tail 12 room 4
load:0x40080400,len:4
load:0x40080404,len:3356
entry 0x4008059c
If I remove all of the lines with ledcAttach from the code I do see sensorVal with a delay and do not see the above. I don't get it, what is that stuff and where does it come from? And why doesn't my Serial.println work?
Or does it mean that ledcAttach failed and this is the error?
//IMPORTANT USE ESP32 Board Version 2.0.17
int sensorVal=100; //Set initial LDR value
int threshold= 2000; //Set light sensitivity value for LDR and conditional statements
#define ldrPin A4 //Set LDR pin connection
void setup()
{
ledcAttach(0, 500, 8); // Set PWM pin connection number and attributes
ledcAttach(1, 500, 8);
ledcAttach(2, 500, 8);
ledcAttach(3, 500, 8);
ledcAttach(4, 500, 8);
ledcAttach(5, 500, 8);
ledcAttach(6, 500, 8);
ledcAttach(7, 500, 8);
ledcAttach(8, 500, 8);
ledcAttach(9, 500, 8);
ledcAttach(10, 500, 8);
ledcAttach(11, 500, 8);
Serial.begin(115200); //Turn on Serial monitor for observing light measurements
}
void loop()
{
sensorVal=analogRead(ldrPin); //Read LDR input value on scale of 0 - 4096
Serial.println("*********************sensorVal"); //Print on Serial Monitor the LDR Value
Serial.println(sensorVal); //Print on Serial Monitor the LDR Value
delay(3000);
}
