Instructions
www.joy-it.net
Pascalstr. 8 47506 Neukirchen-Vluyn
int ledPin = 10; // defines Digital Pin 10.
void setup() {
pinMode(ledPin, OUTPUT); // defines pin to output
}
void loop() {
digitalWrite(ledPin, HIGH); // turns on led
delay(1000); // waits a second
digitalWrite(ledPin, LOW); // turns off led
delay(1000); // waits a second
}
Aer uploading the program you will se the LED which is connected to pin
10 , light up every second.
Lesson 3: PWM light control
PWM (short for Pulse Width Modulation) is a technique used to encode
analog signal levels into digital ones. A computer is not capable of out-
putting analog voltage. It can only output digital voltage with values like
0 V or 5 V. Therefore a high resolution counter is used to output a specific
analog signal level by encoding the utilization level by modulating PWM .
The PWM signal is also digitized, because to each time the power supply
is either 5 V (on) or 0 V (o).
The voltage or current is supplied to the analog load (the device that con-
sumes the energy) by repeated pulse sequences, by constantly switching
between the on and o states. The value of the output voltage is deter-
mined by the on and o states.