#include "mbed.h" #include "C12832.h" #include "Sht31.h" C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11); Sht31 sht31(I2C_SDA, I2C_SCL); DigitalOut led1(p12); DigitalOut led2(p13); DigitalOut...

#include "mbed.h" #include "C12832.h" #include "Sht31.h" C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11); Sht31 sht31(I2C_SDA, I2C_SCL); DigitalOut led1(p12); DigitalOut led2(p13); DigitalOut led(p7); DigitalOut led3(p17); DigitalIn pb(p9); DigitalIn pb1(p16); int main() { printf("Set the temperature above 25 degrees and humidity 25 to trigger the warning LED\n"); printf("Press the push button to turn on the red LED (IR sensor) \n"); printf("Press the push button to turn on the white LED (LDR sensor) \n"); pb.mode(PullUp); while (1) { lcd.cls(); float temp = sht31.readTemperature(); float humidity = sht31.readHumidity(); lcd.locate(3, 3); lcd.printf("Sensor1:Temperature:%.2f C", temp); lcd.locate(3, 13); lcd.printf("Sensor2 Humidity: %.2f %%", humidity); // turn on LED if the temperature is above 25 degrees led1 = temp > 25.0f; led2 = humidity > 25; led = pb; //Sensor 3: IR sensor float led =pb; lcd.locate(3, 23); lcd.printf("Sensor3&4:IR&LDR sensor ",led); lcd.locate(3, 33); lcd.printf("Led : OFF ", led); if(led == 1.0) { led = 0; lcd.locate(3, 23); lcd.printf("Led : _____ON______", led); } led3 = pb1; //Sensor 4: LDR sensor float led3 =pb1; if(led == 1.0) { led = 0; lcd.locate(3, 23); lcd.printf("Led : ON", led3); } wait(0.5f); } } from the given coding. comment on each line of the code and write analysid from it.

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here