State Machines II.

Created by Miroslav Biňas / mirek

![Night Light Illustration](../images/night.security.light.gif) [Night Security Light](https://randomnerdtutorials.com/build-a-night-security-light-with-arduino/)
![Night Security Light: State Diagram](../images/night.light-state.diagram.png)
![PIR Sensor: Pinout](../images/pir.pinout.png) notes: * https://lastminuteengineers.com/pir-sensor-arduino-tutorial/
## Pulse-Width Modulation (PWM)
![PWM Explained](../images/pwm.explained.gif)
## Duty Cycle
![Duty Cycle](../images/duty.cycle.gif) Note: * http://www.bristolwatch.com/picaxe/adc_pwm_demo.htm
![Various Duty Cycles](../images/duty.cycle-various.gif) Note: * https://www.analogictips.com/pulse-width-modulation-pwm/
![Arduino Uno](../images/arduino-board.png)
```cpp void analogWrite(int pin, int level); ```
## PWM Usages * dimming of RGB LEDs * brightness of LEDs * control the direction of a servo motors * in telecomumunications (encoding/decoding data) * audio effects and amplification Note: * https://en.wikipedia.org/wiki/Pulse-width_modulation#Applications
## Questions?