eu sou novo aqui ainda nao estou a ver bem como abrir o topico porque é sobre o erro scope
Using library WiFiManager at version 2.0.17 in folder: C:\Users\joaon\Documents\Arduino\libraries\WiFiManager
Using library WiFi at version 2.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\WiFi
Using library Networking at version 1.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\Network
Using library Update at version 2.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\Update
Using library WebServer at version 2.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\WebServer
Using library FS at version 2.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\FS
Using library DNSServer at version 2.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\DNSServer
Using library ESP32 Async UDP at version 2.0.0 in folder: C:\Users\joaon\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\libraries\AsyncUDP
Using library NTPClient at version 3.2.1 in folder: C:\Users\joaon\Documents\Arduino\libraries\NTPClient
Using library TM1637 at version 1.2.0 in folder: C:\Users\joaon\Documents\Arduino\libraries\TM1637
Using library DFRobotDFPlayerMini at version 1.0.6 in folder: C:\Users\joaon\Documents\Arduino\libraries\DFRobotDFPlayerMini
Using library Ai Esp32 Rotary Encoder at version 1.7 in folder: C:\Users\joaon\Documents\Arduino\libraries\Ai_Esp32_Rotary_Encoder
exit status 1
Compilation error: 'ledcSetup' was not declared in this scope
Esta parte é no programacao...
isto é um resumo do diz..
estas sao o nome das 2 linhas onde de dá erro... a linha 59 e a linha 61
ledcSetup(0, 5000, 8);
ledcAttachPin(RED_LED, 0);
void setup() {
pinMode(RED_LED, OUTPUT);
pinMode(WHITE_LED, OUTPUT);
// configure LED PWM functionalitites
ledcSetup(0, 5000, 8); 59
// attach the channel to the GPIO to be controlled
ledcAttachPin(RED_LED, 0); 61
red1.setBrightness(Display_backlight);
Serial.begin(9600);
WiFi.begin(ssid, password);
while ( WiFi.status() != WL_CONNECTED ) {
delay ( 500 );
Serial.print ( "." );
}
timeClient.begin();
FPSerial.begin(9600, SERIAL_8N1, RXD2, TXD2);
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini Demo"));
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
if (!myDFPlayer.begin(FPSerial, /*isACK = */true, /*doReset = */true)) { //Use serial to communicate with mp3.
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true){
delay(0); // Code to compatible with ESP8266 watch dog.
}
}
Serial.println(F("DFPlayer Mini online."));
myDFPlayer.volume(20); //Set volume value. From 0 to 30
myDFPlayer.play(1); //Play the first mp3
Serial.println("\n Starting");
rotaryEncoder.begin();
rotaryEncoder.setup(readEncoderISR);
rotaryEncoder.setBoundaries(0, 3500, true); //minValue, maxValue, circleValues true|false (when max go to min and vice versa)
rotaryEncoder.setAcceleration(250);
}
void loop() {
timeClient.update();
red1.showNumberDecEx(timeClient.getHours(),0b01000000,true,2,0);
red1.showNumberDecEx(timeClient.getMinutes(),0b01000000,true,2,2);
Serial.print("Time: ");
Serial.println(timeClient.getFormattedTime());
unsigned long epochTime = timeClient.getEpochTime();
struct tm *ptm = gmtime ((time_t *)&epochTime);
int currentYear = ptm->tm_year+1900;
Serial.print("Year: ");
Serial.println(currentYear);
int monthDay = ptm->tm_mday;
Serial.print("Month day: ");
Serial.println(monthDay);
int currentMonth = ptm->tm_mon+1;
Serial.print("Month: ");
Serial.println(currentMonth);
if (myDFPlayer.available()) {
printDetail(myDFPlayer.readType(), myDFPlayer.read()); //Print the detail message from DFPlayer to handle different errors and states.
}
btnState = digitalRead(ROTARY_ENCODER_BUTTON_PIN);
ledcWrite(0, inc_red_led);
digitalWrite(WHITE_LED, LOW);
//If we detect LOW signal, button is pressed
if (btnState == LOW) {
//if 50ms have passed since last LOW pulse, it means that the
//button has been pressed, released and pressed again
if (millis() - lastButtonPress > 50) {
Serial.println("Button pressed!");
Setup_timer();
}
// Remember last button press event
lastButtonPress = millis();
}
if ( inc_red_led <= 254)
inc_red_led = inc_red_led + 0.1;
else inc_red_led = 0;
delay(1);
if((currentMonth30 + monthDay) >= 121 && (currentMonth30 + monthDay) < 331){
timeClient.setTimeOffset(utcOffsetInSecondsUTC);} // Change daylight saving time - Summer - change 31/03 at 00:00
else {timeClient.setTimeOffset((utcOffsetInSecondsUTC) - 3600);} // Change daylight saving time - Winter - change 31/10 at 00:00
}
void Setup_timer() {
red1.showNumberDecEx(88,0b01000000,true,2,0);
red1.showNumberDecEx(88,0b01000000,true,2,2);
digitalWrite(RED_LED, HIGH);
digitalWrite(WHITE_LED, HIGH);
myDFPlayer.play(2);
delay(500);
btnState = digitalRead(ROTARY_ENCODER_BUTTON_PIN);
while (digitalRead(ROTARY_ENCODER_BUTTON_PIN) == HIGH) {
if (rotaryEncoder.encoderChanged())
{
Serial.println(rotaryEncoder.readEncoder());
counter = rotaryEncoder.readEncoder();
}
if (rotaryEncoder.isEncoderButtonClicked())
{
Serial.println("button pressed");
}
minutes = counter / 60;
secondes = ((counter / 60) - minutes) * 60;
red1.showNumberDecEx(minutes,0b01000000,true,2,0);
red1.showNumberDecEx(secondes,0b01000000,true,2,2);
}
Countdown(counter);
Serial.println("Sortie de la boucle");
}
void Countdown (float timer_counter) {
myDFPlayer.play(8);;
delay(1000);
btnState = digitalRead(ROTARY_ENCODER_BUTTON_PIN);
while (btnState == HIGH )
{
btnState = digitalRead(ROTARY_ENCODER_BUTTON_PIN);
for (int i = 10 ; i > 0; i--) {
timer_counter = timer_counter - 0.1;
minutes = timer_counter / 60;
secondes = ((timer_counter / 60) - minutes) * 60;
red1.showNumberDecEx(minutes,0b01000000,true,2,0);
red1.showNumberDecEx(secondes,0b01000000,true,2,2);
delay(70);
digitalWrite(RED_LED, LOW);
}
if (timer_counter <= 0) {
myDFPlayer.play(3);
for ( int i = 0 ; i < 9 ; i++) {
ledcWrite(0, 255);
waitMilliseconds(random(10, 150));
digitalWrite(WHITE_LED, HIGH);
waitMilliseconds(random(10, 150));
ledcWrite(0, 0);
waitMilliseconds(random(10, 150));
digitalWrite(WHITE_LED, LOW);
waitMilliseconds(random(10, 150));
}
myDFPlayer.play(5);
for ( int i = 0 ; i < 9 ; i++) {
ledcWrite(0, 255);
waitMilliseconds(random(10, 150));
digitalWrite(WHITE_LED, HIGH);
waitMilliseconds(random(10, 150));
ledcWrite(0, 0);
waitMilliseconds(random(10, 150));
digitalWrite(WHITE_LED, LOW);
waitMilliseconds(random(10, 150));
}
myDFPlayer.play(7);
for ( int i = 0 ; i < 9 ; i++) {
ledcWrite(0, 255);
waitMilliseconds(random(10, 150));
digitalWrite(WHITE_LED, HIGH);
waitMilliseconds(random(10, 150));
ledcWrite(0, 0);
waitMilliseconds(random(10, 150));
digitalWrite(WHITE_LED, LOW);
waitMilliseconds(random(10, 150));
}
btnState = LOW;
counter = 0;
};
}
}
void waitMilliseconds(uint16_t msWait)
{
uint32_t start = millis();
while ((millis() - start) < msWait)
{
// calling mp3.loop() periodically allows for notifications
// to be handled without interrupts
delay(1);
}
}
void printDetail(uint8_t type, int value){
switch (type) {
case TimeOut:
Serial.println(F("Time Out!"));
break;
case WrongStack:
Serial.println(F("Stack Wrong!"));
break;
case DFPlayerCardInserted:
Serial.println(F("Card Inserted!"));
break;
case DFPlayerCardRemoved:
Serial.println(F("Card Removed!"));
break;
case DFPlayerCardOnline:
Serial.println(F("Card Online!"));
break;
case DFPlayerUSBInserted:
Serial.println("USB Inserted!");
break;
case DFPlayerUSBRemoved:
Serial.println("USB Removed!");
break;
case DFPlayerPlayFinished:
Serial.print(F("Number:"));
Serial.print(value);
Serial.println(F(" Play Finished!"));
break;
case DFPlayerError:
Serial.print(F("DFPlayerError:"));
switch (value) {
case Busy:
Serial.println(F("Card not found"));
break;
case Sleeping:
Serial.println(F("Sleeping"));
break;
case SerialWrongStack:
Serial.println(F("Get Wrong Stack"));
break;
case CheckSumNotMatch:
Serial.println(F("Check Sum Not Match"));
break;
case FileIndexOut:
Serial.println(F("File Index Out of Bound"));
break;
case FileMismatch:
Serial.println(F("Cannot Find File"));
break;
case Advertise:
Serial.println(F("In Advertise"));
break;
default:
break;
}
break;
default:
break;
}
}