User manual

056 Hour++;
057 if(Hour == 24)
058 {
059 Hour = 0;
060 }
061 }
062 }
063 cnt = 0;
064 }
065
066 delay(10);
067 }
If we were to output the counter readings one to one on the
display, the counter readings below 10 would look strange because
the leading zero would not be displayed. For the clock to have
the familiar »00:00:0- format, we need to check if the value
is less than 10 before the output.
001 if(Second < 10) lcd.print("0")
If the value is less than 10, a simple output would only display,
e.g. »12:1:8«. However, we check if the value is less and add
a »0« manually if necessary to fill the tens.
CAPACITY METER
Building your own meters with the simplest of media is always
interesting and exciting. Arduino™ permits programming a ca-
pacity meter for small capacitors in the range of 1 nF to approx.
100 µF for our hobby lab at very low costs and effort. This is
how our capacity meter with auto range function works:
At commencement of the measurement, the variable
C_time
is
initialised with zero. Port D12 is configured as an output and
then immediately switched to LOW (GND), to discharge the
connected capacitor (test piece) before the actual measurement.
After a brief end charging pause of 1 second, port D12 will be
configured as input and the internal pull-up-resistance will be
activated. The pull-up-resistance will now charge the capacitor
to be tested until the port D12 recognises HIGH. The threshold
from when onwards the digital port recognises HIGH is at approx.
3.5 V at an operating voltage of 5 V. This level therefore