Added fake sine wave lfo
parent
ed3445e64e
commit
e57cd4818f
@ -0,0 +1,24 @@
|
||||
int pwmPin = 11; //define output pin, Meergranen output pin is 11
|
||||
|
||||
void setup() {
|
||||
pinMode(pwmPin, OUTPUT); //set pin as output
|
||||
}
|
||||
|
||||
void loop() { // run forever
|
||||
|
||||
for(int value = 0; value<=255; value++){ // cycle through 255 values, start at 0. 8 bit output == 255 values
|
||||
analogWrite(pwmPin, value); // analogWrite simulates smooth sinewave using complex pwm duty cycles
|
||||
delay(30);
|
||||
}
|
||||
|
||||
delay(30);
|
||||
|
||||
// when value == 255, run loop below
|
||||
for(int value = 255; value>=0; value--){ // each loop substract 1 from value
|
||||
analogWrite(pwmPin, value); // analogWrite simulates smooth sinewave using complex pwm duty cycles
|
||||
delay(30);
|
||||
}
|
||||
|
||||
delay(10);
|
||||
|
||||
}
|
Loading…
Reference in New Issue