CSCI-3511: Hardware-Software Interface Lecture 6: Analog and Digital Signals Liang He, Ph.D. Assistant Professor, CSE, UCDenver Digital Signal The LED, when turned on, lit up at the constant brightness What if we want to turn on the LED, but at varying brightness? Control signal: HIGH or LOW voltage CSCI 3511: Hardware-Software Interface Analog Signal How do we make Uno output an analog signal? Any value between 0—5V 5V 0V We can control the brightness of the LED using an analog signal CSCI 3511: Hardware-Software Interface analogWrite() CSCI 3511: Hardware-Software Interface PWM Pins: Use Digital Signal/Pins to Simulate Analog Signal • Pulse Width Modulation (PWM) is a method for changing how long a square wave stays “on” VH VL T = 1/490Hz (or 1/980Hz for pin5 and pin6) Period (T) • The on-off behavior changes the average power of the signal • If signal toggles between on and off quicker than the load, then the load is not affected by the toggling CSCI 3511: Hardware-Software Interface Pins of Arduino Uno CSCI 3511: Hardware-Software Interface Let’s Try analogWrite() Try to remove this statement CSCI 3511: Hardware-Software Interface Lab-4: Basic: Controlling LED Brightness Using PWM • Build the above hard/software components • Demonstrate the lab to me in class • If cannot complete in class • Record a demonstration video of the lab • Submit the video on Canvas CSCI 3511: Hardware-Software Interface