Arduino-LCD
LCD library for Arduino
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Thermometer.ino
Go to the documentation of this file.
1
#include "GPIO.h"
2
3
#include "OWI.h"
4
#include "Software/OWI.h"
5
#include "Driver/DS18B20.h"
6
7
#include "TWI.h"
8
#include "Hardware/TWI.h"
9
#include "Software/TWI.h"
10
11
#include "
LCD.h
"
12
#include "
Driver/MAX72XX.h
"
13
#include "
Driver/PCD8544.h
"
14
#include "
Driver/HD44780.h
"
15
#include "
Adapter/Debug.h
"
16
#include "
Adapter/PP7W.h
"
17
#include "
Adapter/SR3W.h
"
18
#include "
Adapter/SR4W.h
"
19
#include "
Adapter/MJKDZ.h
"
20
#include "
Adapter/GY_IICLCD.h
"
21
#include "
Adapter/DFRobot_IIC.h
"
22
#include "
Shield/LCD4884.h
"
23
#include "
Shield/LCD_Keypad.h
"
24
25
// Configure: HD44780 Adapter; Debug, PP7W, SR3W or TWI PCF8574
26
// LCD::Debug io(Serial);
27
// LCD::PP7W<BOARD::D4, BOARD::D5, BOARD::D6, BOARD::D7, BOARD::D8, BOARD::D9, BOARD::D10> io;
28
// LCD::SR3W<BOARD::D7, BOARD::D6, BOARD::D5> io;
29
// LCD::SR4W<BOARD::D7, BOARD::D6, BOARD::D5, BOARD::D4> io;
30
// Software::TWI<BOARD::D1, BOARD::D2> twi;
31
// Software::TWI<BOARD::D8, BOARD::D9> twi;
32
// Software::TWI<BOARD::D18, BOARD::D19> twi;
33
Hardware::TWI
twi
(100000UL);
34
// Hardware::TWI twi(400000UL);
35
// LCD::MJKDZ io(twi);
36
LCD::GY_IICLCD
io
(
twi
);
37
// LCD::DFRobot_IIC io(twi);
38
39
// Configure: LCD; HD44780, MAX72XX, or PCD8544, LCD4884 or LCD_Keypad
40
HD44780
lcd
(
io
);
41
// MAX72XX<BOARD::D10, BOARD::D11, BOARD::D13> lcd;
42
// PCD8544<BAORD::D5, BOARD::D4, BOARD::D3, BOARD::D2> lcd;
43
// LCD4884 lcd;
44
// LCD_Keypad lcd;
45
46
// Software::OWI<BOARD::D0> owi;
47
Software::OWI<BOARD::D7>
owi
;
48
DS18B20
sensor
(
owi
);
49
50
void
setup
()
51
{
52
lcd
.
begin
();
53
}
54
55
void
loop
()
56
{
57
uint8_t* rom =
sensor
.rom();
58
int8_t last =
owi
.FIRST;
59
int
id
= 0;
60
61
// Broadcast a convert request to all thermometer sensors
62
if
(!
sensor
.convert_request(
true
))
return
;
63
delay(
sensor
.conversion_time());
64
65
// Display sensor identity and temperture
66
do
{
67
last =
owi
.search_rom(
sensor
.FAMILY_CODE, rom, last);
68
if
(last ==
owi
.ERROR)
break
;
69
bool
res =
sensor
.read_scratchpad(
false
);
70
if
(!res)
continue
;
71
lcd
.
display_clear
();
72
73
// Display rom identity or sensor sequence number
74
if
(
lcd
.
HEIGHT
> 1 &&
lcd
.
WIDTH
> 15) {
75
for
(
size_t
i = 0; i <
sizeof
(rom); i++) {
76
if
(rom[i] < 0x10)
lcd
.print(
'0'
);
77
lcd
.print(rom[i], HEX);
78
}
79
}
80
else
{
81
lcd
.print(
id
++);
82
lcd
.print(
' '
);
83
}
84
85
// Display temperature
86
lcd
.print(
sensor
.temperature());
87
lcd
.print(F(
" C"
));
88
delay(1000);
89
}
while
(last !=
owi
.LAST);
90
}
PCD8544.h
HD44780::begin
virtual bool begin()
Definition:
HD44780.h:132
Debug.h
io
LCD::GY_IICLCD io(twi)
twi
Hardware::TWI twi(100000UL)
MJKDZ.h
MAX72XX.h
GY_IICLCD.h
setup
void setup()
Definition:
Thermometer.ino:50
sensor
DS18B20 sensor(owi)
SR4W.h
HD44780::display_clear
virtual void display_clear()
Definition:
HD44780.h:212
LCD::GY_IICLCD
Definition:
GY_IICLCD.h:49
HD44780::HEIGHT
const uint8_t HEIGHT
Definition:
HD44780.h:106
lcd
HD44780 lcd(io)
DFRobot_IIC.h
LCD_Keypad.h
LCD4884.h
HD44780
Definition:
HD44780.h:34
owi
Software::OWI< BOARD::D7 > owi
Definition:
Thermometer.ino:47
LCD.h
SR3W.h
PP7W.h
HD44780.h
loop
void loop()
Definition:
Thermometer.ino:55
HD44780::WIDTH
const uint8_t WIDTH
Definition:
HD44780.h:103
examples
Thermometer
Thermometer.ino
Generated on Sat Oct 14 2017 03:06:11 for Arduino-LCD by
1.8.11