tailieunhanh - Practical Arduino Cool Projects for Open Source Hardware- P40

Practical Arduino Cool Projects for Open Source Hardware- P40: A schematic or circuit diagram is a diagram that describes the interconnections in an electrical or electronic device. In the projects presented in Practical Arduino, we’ve taken the approach of providing both a photograph and/or line drawing of the completed device along with a schematic. While learning to read schematics takes a modest investment of your time, it will prove useful time and time again as you develop your projects. With that in mind, we present a quick how-to in this section | CHAPTER 15 VEHICLE TELEMETRY PLATFORM delay 5 Then just when you think it s all done the previous sequence is executed one final time but with the value B0010. lcdpushNibble B00100000 lcdcommandWriteSet delay 1 After that the LCD will be initialized and it s possible to write commands to it much less laboriously. The function lcd_commandWrite can now be used to send subsequent commands so first it s set to 4-bit mode with a 5 x 8 font as follows lcdcommandWrite B00101000 Then display control is turned on with a hidden cursor and no blink as follows lcdcommandWrite B00001100 Entry mode is set for automatic position increment with no display shift as follows lcdcommandWrite B00000110 The LCD is now ready to go but the function still needs to define those custom characters. The controller can store up to eight user-defined characters so the OBDuinoMega sketch uses them for the following Character 0 not used Characters 1 and 2 L 100 Characters 3and 4 km h Character 5 degree Characters 6 and 7 mi g Because the program needs to define a total of only seven custom characters it doesn t use the first character position in memory so it defines NB_CHAR and then calls lcd_commandWrite to set the character-generator memory address to 0x08 B1001000 to skip the first eight rows. define NBCHAR 7 lcdcommandWrite B01001000 The characters are defined using a simple bitmap which means that if the data is formatted in the correct way and you squint your eyes just right you can pretend you re in The Matrix and actually see the characters in the binary data just by looking at the array. To make it really easy for you to see we ve made the high bits bold. static proguchar chars PROGMEM B10000 B00000 B10000 B00010 B00111 B11111 B00010 B100003B00000 B10100JB00100JB00101JB10101JB00100J B11001 B00000 B11000 B01000 B00111 B10101 B01000 B00010JB00000JB10100 B10000 B00000JB00000JB100001 B00100JB00000JB00000 B00100 B00000 B00100JB00111 B01001 B11011 B11111 B00100 B00000 B00000 B00100 B00001 .