Switches & Inputs
I recently bought a Heltek Wifi kit 8 and noticed that although the board itself seems to be a good board the pin-outs, both online and on the silk screen of the board are wrongly specified. For example the silk screen shows SDA and SCL on non standard pins, but this is not the case as far as I can tell. To get this information, I’ve followed the schematic then proven these findings with in circuit testing to prove it.
In this tutorial and accompanying youtube video (left), I discuss how Arduino inputs and outputs work. Arduino 8 bit boards are mainly based on Atmel AVR chips, in fact the Mega is named after the chip number AVR-Mega-2560. Outputs on the AVR chips are much more versatile than they first look, and the video covers this in detail. If you are using an Arduino pro or other 3V3 based Arduino, replace the 5V mentioned here with 3V3.
When writing Arduino code that needs quite a few IO pins, you may need to expand the IO using a shift register or i2c expansion device such as the PCF8574. Up until now that meant significantly changing your code to use the new device. If you were using the IoAbstraction library then you’d just set up a different type of IO. This library allows you to treat shift registers and i2c exapnders almost as if they were pins.
When we press a button that’s connected to an Arduino input, it is likely that the button will momentarily “flicker” between the on and off state. This gives false readings for a short period of time after the button is pressed. Problems caused by this can range from the mild annoyance of a slight flicker, to doing something more than once that should have only happened once. Therefore we need a way to ignore these false readings; ensuring we only consider the button pressed or released when we know for sure that it is “stable”.