| 70 | } // namespace |
| 71 | |
| 72 | void init() |
| 73 | { |
| 74 | Serial.begin(SERIAL_BAUD_RATE); // 115200 by default |
| 75 | Serial.systemDebugOutput(true); // Enable debug output to serial |
| 76 | |
| 77 | // WIFI not needed for demo. So disabling WIFI. |
| 78 | #ifndef DISABLE_WIFI |
| 79 | WifiStation.enable(false); |
| 80 | WifiAccessPoint.enable(false); |
| 81 | #endif |
| 82 | |
| 83 | // Change PWM frequency if required: period is in microseconds |
| 84 | // pwm.setPeriod(100); |
| 85 | |
| 86 | maxDuty = pwm.getMaxDuty(); |
| 87 | auto period = pwm.getPeriod(); |
| 88 | auto freq = pwm.getFrequency(LED_PIN); |
| 89 | |
| 90 | Serial << _F("PWM period = ") << period << _F("us, freq = ") << freq << _F(", max. duty = ") << maxDuty << endl; |
| 91 | |
| 92 | // Set default PWM values |
| 93 | for(unsigned i = 0; i < ARRAY_SIZE(pins); ++i) { |
| 94 | pwm.analogWrite(pins[i], maxDuty * defaultDutyPercent[i] / 100); |
| 95 | } |
| 96 | |
| 97 | Serial << _F("PWM output set on all ") << ARRAY_SIZE(pins) << _F(" Pins. Kindly check...") << endl |
| 98 | << _F("Now LED (pin ") << LED_PIN << _F(") will go from 0 to VCC to 0 in cycles.") << endl; |
| 99 | procTimer.initializeMs<100>(doPWM).start(); |
| 100 | } |
nothing calls this directly
no test coverage detected