EasyManua.ls Logo

Keyestudio Ks0428 - Project 2: Adjust LED Brightness; Description

Keyestudio Ks0428
247 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
76
www.keyestudio.com
void setup() { // initialize digital pin 10 as an output.
pinMode(10, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage
level)
delay(100); // wait for 0.1 second
digitalWrite(10, LOW); // turn the LED off by making the voltage
LOW
delay(100); // wait for 0.1 second
}
//****************************************************************
The LED flickers faster through the test result, therefore, pins and
delay time affect flash frequency.
Project 2: Adjust LED Brightness
(1) Description
In previous lesson, we control LED on and off and make it blink.
In this project, we will control LED brightness through PWM to
simulate breathing effect. Similarly, you can change the step length
and delay time in the code so as to demonstrate different breathing

Table of Contents

Related product manuals