Waveform Generator added

This commit is contained in:
Joe Tretter
2020-09-22 22:08:02 -05:00
parent 834129faf6
commit 129f8ec2b2

View File

@@ -11,7 +11,7 @@ void setup() {
// Initialize channels // Initialize channels
// channels 0-15, resolution 1-16 bits, freq limits depend on resolution // channels 0-15, resolution 1-16 bits, freq limits depend on resolution
// ledcSetup(uint8_t channel, uint32_t freq, uint8_t resolution_bits); // ledcSetup(uint8_t channel, uint32_t freq, uint8_t resolution_bits);
ledcSetup(0, 4000, 8); // 12 kHz PWM, 8-bit resolution ledcSetup(0, 12000, 8); // 12 kHz PWM, 8-bit resolution
} }
// the loop routine runs over and over again forever: // the loop routine runs over and over again forever:
@@ -22,7 +22,7 @@ void loop() {
brightness = brightness + fadeAmount; brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade: // reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) { if (brightness <= 0 || brightness >= 254) {
fadeAmount = -fadeAmount; fadeAmount = -fadeAmount;
} }
// wait for 30 milliseconds to see the dimming effect // wait for 30 milliseconds to see the dimming effect