Posts

Showing posts with the label Technical

How to Flicker an LED

Image
In the last tutorial we covered how not to blink an LED , where I explained what was wrong with the most common blink example and showed a much more elegant solution. We now have an LED that switches between 'Off' and 'Blindingly Bright', there has to be another way that gives us more control over the LED, reduces the brightness (and therefore power consumption) and that could also give us a bit more 'character' for our lights. The answer is Pulse Width Modulation , or PWM for short. By switching the LED power on and off, imperceptibly quickly we can control the average amount of Voltage that is supplied to the LED, which in turn reduces the current and brightness of the LED. If we switch the power on and off faster than the LED can react, the LED will receive an average Voltage that is proportional to the ratio between on and off. If the LED is on for half the time and off for half the time it will receive half of the full voltage. It is possible to create the...

How not to Blink an LED

Image
It is my intention to cover the whole depth of the coding that went into the NikolAI puzzle box  and I really didn't want to start with the 'Blink LED' project because everybody does that and it's been done a million times over but it's just too darn useful. I'm not going to cover setting up Arduino because even I've done that tutorial before. PinMode(2, OUTPUT); set up digital line 2 as an output to turn the LED on/off DigitalWrite(2, HIGH/LOW); actually turns the digital line 2 on/off, blinking an LED Delay(1000); creates a time delay of 1000 milliseconds between turning the line on/off So there it is, the simplest blink LED program. This can be found all over the internet and it does the job of blinking an LED and that's about it. There's actually a few issues with this as a program and you'd never use it in sensible program so I thought it would actually be much more useful for me to describe what's wrong with this example and lay ...