fix pwm init bug

This commit is contained in:
Siwat Sirichai 2023-08-26 17:28:21 +07:00
parent 346aa9796e
commit 77e7330639
1 changed files with 7 additions and 1 deletions

View File

@ -79,6 +79,7 @@ void setup()
Serial.begin(115200);
Serial.println("ESPMega R3 Initializing . . .");
ESPMega_begin();
io_begin();
network_begin();
Serial.println("Initializing MQTT . . .");
mqtt_connect();
@ -99,7 +100,9 @@ void io_begin()
{
Serial.println("Initializing I/O . . .");
memset(pwm_states, 0, PWM_COUNT);
memset(pwm_values, 255, PWM_COUNT);
for(int i=0;i<PWM_COUNT;i++) {
pwm_values[i] = 4095;
}
}
void network_begin()
@ -201,6 +204,9 @@ void virtual_interrupt_callback(int pin, int state)
{
publish_input_state(pin,state);
Serial.printf("Pin %d changed to %d\n", pin, state);
if(pin==15) {
pwm_toggle(4);
}
}
void virtual_interrupt_loop()