sht21 nucleo 073
Dependencies: SHT21_ncleee mbed
main.cpp@0:c65ff4c522cf, 2018-10-30 (annotated)
- Committer:
- asdjah
- Date:
- Tue Oct 30 07:55:14 2018 +0000
- Revision:
- 0:c65ff4c522cf
????????? ? ??????????? ????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asdjah | 0:c65ff4c522cf | 1 | #include "mbed.h" |
asdjah | 0:c65ff4c522cf | 2 | #include "SHT21_ncleee.h" |
asdjah | 0:c65ff4c522cf | 3 | |
asdjah | 0:c65ff4c522cf | 4 | DigitalOut led(LED2); |
asdjah | 0:c65ff4c522cf | 5 | I2C i2c(I2C_SDA,I2C_SCL); |
asdjah | 0:c65ff4c522cf | 6 | SHT21 sht(&i2c); |
asdjah | 0:c65ff4c522cf | 7 | |
asdjah | 0:c65ff4c522cf | 8 | int main() |
asdjah | 0:c65ff4c522cf | 9 | { |
asdjah | 0:c65ff4c522cf | 10 | while(1) { |
asdjah | 0:c65ff4c522cf | 11 | led = 1; // LED is ON |
asdjah | 0:c65ff4c522cf | 12 | wait(0.2); // 200 ms |
asdjah | 0:c65ff4c522cf | 13 | led = 0; // LED is OFF |
asdjah | 0:c65ff4c522cf | 14 | wait(0.8); // 800 ms |
asdjah | 0:c65ff4c522cf | 15 | |
asdjah | 0:c65ff4c522cf | 16 | printf("Hello World...\n\tTesting temperature Sensor\n"); |
asdjah | 0:c65ff4c522cf | 17 | int temperature = sht.readTemp(); |
asdjah | 0:c65ff4c522cf | 18 | printf("Temperature is: %d \n", temperature); |
asdjah | 0:c65ff4c522cf | 19 | printf("Experiment complete...\n"); |
asdjah | 0:c65ff4c522cf | 20 | int humidity= sht.readHumidity(); |
asdjah | 0:c65ff4c522cf | 21 | printf("Vlajnost: %d \n",humidity); |
asdjah | 0:c65ff4c522cf | 22 | |
asdjah | 0:c65ff4c522cf | 23 | } |
asdjah | 0:c65ff4c522cf | 24 | } |