From e2f1114269103cab3eaf5931ea65242689c9ab6d Mon Sep 17 00:00:00 2001 From: Damlanur Date: Fri, 18 Oct 2019 14:24:40 +0200 Subject: [PATCH] - --- basics/simple-pwm-led/pwm-led.ino | 41 ------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 basics/simple-pwm-led/pwm-led.ino diff --git a/basics/simple-pwm-led/pwm-led.ino b/basics/simple-pwm-led/pwm-led.ino deleted file mode 100644 index 5b01adf..0000000 --- a/basics/simple-pwm-led/pwm-led.ino +++ /dev/null @@ -1,41 +0,0 @@ -/* - LED PWM - Uses 2 pots to control the duty cycle of a Pulse Width Modulation - - <---- pot 0 ----> <---- pot 0 ----> - | | | - | | | - | | | - <-- pot 1 --> <--- ... -*/ - -#define LED (13) -#define POT_1 (0) -#define POT_2 (1) - -int delay_on; -int delay_off; - -void setup() { - // initialize the digital pin as an output. - // Pin 13 has an LED connected on the nano board: - pinMode(LED, OUTPUT); -} - -void loop() { - // We read the value of the pots at the beginning of the loop - // and store them as integer variables (declared at the top) - //delay_on = analogRead(POT_1); - //delay_off = analogRead(POT_2); - // - // But in meergranen PCB 1.0, the pots are wired the wrong way - // So we need to adjust that :) - delay_on = 1023 - analogRead(POT_1); - delay_off = 1023 - analogRead(POT_2); - - // Parameters for the PWM - digitalWrite(LED, HIGH); // turn the LED on - delay(delay_on); // wait for delay_on ms - digitalWrite(LED, LOW); // turn the LED off - delay(delay_off); // wait for delay_off ms -}