dim a led
dim a led
* Credits: https://www.plusivo.com
*
* Lesson 2: Dim an LED
*
* The main purpose of the code is to show how to use the
* PWM technique and how to change the brightness of an LED.
*
* Make sure you connected the LED correctly (anode to positive and
* cathode to ground), otherwise, you will burn the LED. Also, do not
* forget to use the resistor.
*
* More information about the connection can be found in the guide.
*
*/
//the int variable "LED" stores the pin used by the LED
const int LED = D6;
//the setup function runs only once when the board is powered
void setup()
{
//the following instruction initialises the pin stored in the
//variable LED as OUTPUT
pinMode(LED, OUTPUT);
}
//wait 2 milliseconds
delay(2);
}
//wait 2 milliseconds
delay(2);
}