Brian Sherwin

Brian Sherwin bsherwin

Niner since 2006

Entries

Sessions

Discussions

Comments

  • The Maker Show: Episode 2 - Blinking LED...Now What?

    Nothing special about the 50k resistor (except it was what I had on hand when shooting the video). The analogRead will give you a values between 0 and 1023. This represents the a value from 0 to 5v...so it's not entirely arbitrary. When the voltage is 0, the value is 0. When the voltage is 5v, you will have 1023. If you incorrectly connected this to a 3.3v pin, you would only get up to a value around 670 - 680.

    On the other hand, analogWrite only takes values between 0 and 255. 0 being always off and 255 being always on. Otherwise it is a pulse is at a regular frequency (depending on the speed of the pin). This is PWM. To be clear, the LED is digital. Connecting it to a PWM port allows you to blink it on and off in a frequency that is more off than on (less than 128) or more on than off (greater than 128) and allowing perception to take over on the "brightness" of the LED.

    A great place to read more about potentiometers and Arduino is here: https://www.arduino.cc/en/Tutorial/AnalogInput