This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:remotelab:sut:generalpurpose2:b2 [2019/07/26 13:39] – pczekalski | en:iot-open:remotelab:sut:generalpurpose2:b2 [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== Temperature | + | ==== B2: Presenting temperature |
| - | In this scenario you will present temperature and humidity as read by the attached | + | In this scenario, you will present temperature and humidity as read by the attached |
| === Target group === | === Target group === | ||
| Beginners | Beginners | ||
| Line 10: | Line 10: | ||
| #include < | #include < | ||
| </ | </ | ||
| - | The temperature and humidity sensor is all-in-one, | + | The temperature and humidity sensor is all-in-one, |
| To read data you may use a dedicated library (libraries): | To read data you may use a dedicated library (libraries): | ||
| <code c> | <code c> | ||
| Line 18: | Line 18: | ||
| === Scenario === | === Scenario === | ||
| Once you initialise sensor and LCD display, read sensor data (temperature and humidity, mind they' | Once you initialise sensor and LCD display, read sensor data (temperature and humidity, mind they' | ||
| - | <note warning> | + | <note warning> |
| The first line of the LCD should display: "// | The first line of the LCD should display: "// | ||
| The second line should provide temperature within the "// | The second line should provide temperature within the "// | ||
| Line 32: | Line 32: | ||
| === Steps === | === Steps === | ||
| - | // Write some extra information if i.e. some steps are optional otherwise cancel this paragraph (but do not remove header).// | + | |
| == Step 1 == | == Step 1 == | ||
| - | Include LCD driver | + | Include LCD and DHT sensor |
| <code c> | <code c> | ||
| #include < | #include < | ||
| Line 42: | Line 42: | ||
| == Step 2 == | == Step 2 == | ||
| - | Instantiate software | + | Instantiate software |
| <code c> | <code c> | ||
| - | LiquidCrystal_I2C lcd(0x3F, | + | LiquidCrystal_I2C lcd(0x3F, |
| - | DHT dht(DHTpin,DHT22,50); | + | // |
| + | // | ||
| + | DHT dht(DHTpin, | ||
| </ | </ | ||
| == Step 3 == | == Step 3 == | ||
| Line 54: | Line 56: | ||
| == Step 4 == | == Step 4 == | ||
| - | Initialize LCD and dht sensor: | + | Initialize LCD and DHT sensor: |
| <code c> | <code c> | ||
| ... | ... | ||
| - | lcd.init(D2, | + | lcd.init(D2, |
| lcd.backlight(); | lcd.backlight(); | ||
| lcd.home(); | lcd.home(); | ||
| ... | ... | ||
| dht.begin(); | dht.begin(); | ||
| - | delay(1000); | + | delay(1000); |
| ... | ... | ||
| </ | </ | ||
| Line 84: | Line 86: | ||
| ... | ... | ||
| </ | </ | ||
| - | <note tip>'' | + | <note tip>'' |
| + | <code c> | ||
| + | delay(time) | ||
| + | </ | ||
| === Result validation === | === Result validation === | ||
| - | Observe temperature and humidity readings on the LCD. Temperature | + | Observe temperature and humidity readings on the LCD. The temperature in our lab usually |