#include"Cloud_PLC.h"
// Default PWM properties
int freq = 5000; // PWM frequency in Hz
int ledChannel = 0; // PWM channel (0-15)
int resolution = 8; // PWM resolution (8 bits, 0-255)
void Cloud_PLC_PWM(int frequency, int pwmResolution)
{
freq = frequency;
resolution = pwmResolution;
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(NETWORK_LED, ledChannel);//PIN NO 12
}
// Function to increase brightness
void increaseBrightness()
{
for (int dutyCycle = 0; dutyCycle <= 255; dutyCycle++)
{
 ledcWrite(ledChannel, dutyCycle);
 delay(15);
}
}
// Function to decrease brightness
void decreaseBrightness()
{
for (int dutyCycle = 255; dutyCycle >= 0; dutyCycle--)
{
 ledcWrite(ledChannel, dutyCycle);
 delay(15);
}
}
void setup()
{
Cloud_PLC_PWM(freq, resolution); // Call Cloud_PLC_PWM with default values
}
void loop()
{
increaseBrightness();
decreaseBrightness();
}