void setLEDs() { ledPWM.analogWrite(redLED, Red); ledPWM.analogWrite(greenLED, Green); ledPWM.analogWrite(blueLED, Blue); Serial.println("----------------"); Serial.println(Red); Serial.println(Green); Serial.println(Blue); }
void init() { Serial.begin(SERIAL_BAUD_RATE); // 115200 by default Serial.systemDebugOutput(true); // Enable debug output to serial // WIFI not needed for demo. So disabling WIFI. WifiStation.enable(false); WifiAccessPoint.enable(false); // Setting PWM values on 8 different pins HW_pwm.analogWrite(4, 22222); HW_pwm.analogWrite(5, 11111); HW_pwm.analogWrite(0, 22222); HW_pwm.analogWrite(2, 11111); HW_pwm.analogWrite(15, 22222); HW_pwm.analogWrite(13, 11111); HW_pwm.analogWrite(12, 22222); HW_pwm.analogWrite(14, 11111); debugf("PWM output set on all 8 Pins. Kindly check..."); debugf("Now Pin 2 will go from 0 to VCC to 0 in cycles."); procTimer.initializeMs(100, doPWM).start(); }
void doPWM() { if (countUp == true) { i += inc; if (i >= 22222) { i = 22222; countUp = false; } } else { i -= inc; if (i <= 0) { i = 0; countUp = true; } } HW_pwm.analogWrite(2, i); }