Ceci est une ancienne révision du document !
It’s now time to break out the LCD screen and get some off-computer display going on. I have to be honest and admit that it took me about five tries to get the LCD screen to work properly. The example code in the Arduino IDE explicitly states that the LCD needs only about 6 wires. Rubbish! It requires about 12 of the 16 used as it (obviously) requires power, ground, and at least one wire to a potentiometer (pot) or PWM pin to control the screen brightness. After about two tries I was getting a bit frustrated and ended up just pulling all the wires out and starting again. Fifth time lucky! I finally got a “Hello World!” message and could brighten/darken the screen using a 10k pot.
C'est le moment de découvrir l'écran LCD et et de mettre en route un affichage en sortie du processeur.
Je dois être honnête et admettre qu'il m'a fallu 5 essais avant que l'écran LCD fonctionne correctement. Le code exemple dans l'Arduino IDE établit explicitement que le LCD n'utilise que 6 fils. Erreur ! Il a besoin de 12 des 16 fils parce qu'il a besoin du plus d'alimentation (évidemment), de la masse, et d'au moins 1 fil vers un potentiomètre (pot) ou le contact PWM pour régler la luminosité de l'écran. Après 2 essais environ, j'étais un peu dépité et finissais de sortir tous les fils pour recommencer. Chanceux à la 5ème fois ! J'avais enfin le message “Hello World” et je pouvais éclaircir ou assombrir l'écran avec un potentiomètre de 10k.
Humidity Sensor I’d previously tinkered with my humidity sensor. That took a bit of investigating to get some decent code as the code with the sensor kit wouldn’t even compile. I eventually found some code here: http://playground.arduino.cc/main/DHT11Lib which is for the DHT11 module (as used by this sensor). As it says on that page, you need to create two files – dht11.h and dht11.cpp – and paste the relevant code (from that page) into the two files. Now I can compile the code from that page to get a working humidity sensor which displays the temperature and humidity to the serial display in the Arduino IDE. Wiring up the sensor was easy enough as it needs only 5v (middle pin, not labelled), - (ground), and the S(ensor) pin going to the Arduino.
Assemble! With those two working (independently) it was time to try and combine the code (and parts) into one board, and create a digital thermometer. It was easier than I had expected. I opened the humidity sensor code and simply copied over the LCD include, initialisation line, and included the humidity variables in the lcd.print commands – and voila! My code (for your enjoyment) is at: http://pastebin.com/jtkK38ES As you can see, the degrees Centigrade ('C) isn’t displaying quite properly. A kind Redditor messaged me the code shown left (which I haven’t tested as yet). Here is a cool tool that allows you to create your own custom characters: http://fusion94.org/lcdchargen/