Created
October 9, 2022 06:37
-
-
Save cuu/0f4932b4e7bb29be034a1c89c4018659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ledPin=PA8; | |
HardwareTimer timer(1); | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(ledPin,OUTPUT); | |
digitalWrite(ledPin,LOW); | |
pinMode(ledPin,PWM); | |
timer.setPeriod(200); | |
timer.resume(); | |
} | |
void loop() { | |
pinMode(ledPin,PWM); | |
for(int fadeValue=0;fadeValue<=6553; fadeValue+=200) { | |
pwmWrite(ledPin,fadeValue); | |
delay(30); | |
} | |
for(int fadeValue= 6553;fadeValue>=0;fadeValue-=200) { | |
pwmWrite(ledPin,fadeValue); | |
delay(30); | |
} | |
pwmWrite(ledPin,0); | |
delay(400); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment