fix pwm init bug
This commit is contained in:
parent
346aa9796e
commit
77e7330639
|
@ -79,6 +79,7 @@ void setup()
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println("ESPMega R3 Initializing . . .");
|
Serial.println("ESPMega R3 Initializing . . .");
|
||||||
ESPMega_begin();
|
ESPMega_begin();
|
||||||
|
io_begin();
|
||||||
network_begin();
|
network_begin();
|
||||||
Serial.println("Initializing MQTT . . .");
|
Serial.println("Initializing MQTT . . .");
|
||||||
mqtt_connect();
|
mqtt_connect();
|
||||||
|
@ -99,7 +100,9 @@ void io_begin()
|
||||||
{
|
{
|
||||||
Serial.println("Initializing I/O . . .");
|
Serial.println("Initializing I/O . . .");
|
||||||
memset(pwm_states, 0, PWM_COUNT);
|
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()
|
void network_begin()
|
||||||
|
@ -201,6 +204,9 @@ void virtual_interrupt_callback(int pin, int state)
|
||||||
{
|
{
|
||||||
publish_input_state(pin,state);
|
publish_input_state(pin,state);
|
||||||
Serial.printf("Pin %d changed to %d\n", pin, state);
|
Serial.printf("Pin %d changed to %d\n", pin, state);
|
||||||
|
if(pin==15) {
|
||||||
|
pwm_toggle(4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void virtual_interrupt_loop()
|
void virtual_interrupt_loop()
|
||||||
|
|
Loading…
Reference in New Issue