Keyestudio Ks0428 Manual page 83

Table of Contents

Advertisement

www.keyestudio.com
of first square wave is 0% and its corresponding value is 0. The LED
brightness is lowest, that is, turn off. The more time high level lasts,
the brighter the LED. Therefore, the last duty cycle is 100%, which
correspond to 255, LED is brightest. 25% means darker.
PWM mostly is used for adjusting the LED brightness or rotation
speed of motor.
It plays vital role in controlling smart robot car. I believe that you
can't wait to enter next project.
(8) Extension Practice:
Let's modify the value of delay and remain the pin unchanged,
then observe how LED changes.
/*
keyestudio Mini Tank Robot V2
lesson 2.2
pwm-slow
http://www.keyestudio.com
*/
int ledPin = 10; // Define the LED pin at D10
int value;
void setup ()
{
pinMode (ledPin, OUTPUT); // initialize ledpin as an output.
83

Advertisement

Table of Contents
loading

Table of Contents