Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 */ 00005 #include "delay.h" 00006 #include "mbed.h" 00007 #include "TextLCD.h" 00008 DigitalOut myled(D13); 00009 AnalogIn sensor(A0); 00010 DigitalOut Relay(D9,1); 00011 int flag=0; 00012 TextLCD lcd(PA_8,PA_1,PA_4,PB_0,PC_1,PC_0); 00013 int main() 00014 { 00015 00016 while (1) { 00017 00018 printf("light(%f)",sensor.read()); 00019 if(sensor.read()>0.8) { 00020 lcd.cls(); 00021 00022 flag=1; 00023 myled =1; 00024 Relay=0; 00025 00026 lcd.locate(3,0); 00027 lcd.printf("its Dark"); 00028 lcd.locate(3,1); 00029 lcd.printf("LED ON"); 00030 00031 00032 } else { 00033 myled=0; 00034 Relay=1; 00035 // lcd.cls(); 00036 lcd.locate(3,0); 00037 lcd.printf("its Light"); 00038 lcd.locate(3,1); 00039 lcd.printf("LED OFF"); 00040 // lcd.cls(); 00041 } 00042 delay_ms(500); 00043 } 00044 } 00045
Generated on Tue Nov 1 2022 17:16:14 by
1.7.2