This code allows you to increase the brightness of an LED by holding down a button. Release the button to allow the light to dim to nothing.
Read the Code Walkthrough Text (click to open)
New Concept: Digital Versus Analog
Some things in the world are very much 'on' or 'off', like a light switch or a car engine. In code, you can think of those types of things as 'digital'. Other things, like a dimmer switch or car's tire speed, are measured on a spectrum. They still have an 'off' position and a 'maximum' position, but there are many small steps between those extremes. These things are 'analog' in code.
With Maker Board, analogWrite() has a range of outputs from 0 to 255. The analogRead() function has a scale of 0-1023 where it can take readings.