123

Dependencies:   mbed DigitDisplay Grove_LCD_RGB_Backlight

Files at this revision

API Documentation at this revision

Comitter:
mashabozorgzad
Date:
Wed Apr 07 17:37:11 2021 +0000
Commit message:
hjgjhgj

Changed in this revision

DigitDisplay.lib Show annotated file Show diff for this revision Revisions of this file
Grove_LCD_RGB_Backlight.lib Show annotated file Show diff for this revision Revisions of this file
labproject.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 1e3da2405347 DigitDisplay.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DigitDisplay.lib	Wed Apr 07 17:37:11 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Seeed/code/DigitDisplay/#d3173c8bfd48
diff -r 000000000000 -r 1e3da2405347 Grove_LCD_RGB_Backlight.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Grove_LCD_RGB_Backlight.lib	Wed Apr 07 17:37:11 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/cmatz3/code/Grove_LCD_RGB_Backlight/#5ce38ef7a7db
diff -r 000000000000 -r 1e3da2405347 labproject.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/labproject.cpp	Wed Apr 07 17:37:11 2021 +0000
@@ -0,0 +1,104 @@
+#include "mbed.h"                   // include the MBED library
+#include "DigitDisplay.h" 
+#include "Grove_LCD_RGB_Backlight.h"
+
+DigitDisplay display(D2,D3); 
+Serial blue(D1,D0); 
+Grove_LCD_RGB_Backlight LCD(D14,D15);     // flash represents the LCD connect
+Grove_LCD_RGB_Backlight flash(D14,D15);  
+InterruptIn PIR(D6); 
+char buf[20];
+short motion_detected=0;
+void LOW(void);
+char bnum; 
+int main()
+{
+                   // set button # to zero and shut off RGB leds
+        
+    while(1) {                  // set up infinte loop
+         //button number
+                if ((bnum>='1')&&(bnum<='4')) //is a number button 1..4
+                {
+                    switch(bnum)
+                    {
+                        case '1':   
+                        
+                        LCD.clear();
+                        LCD.setRGB(0x00,0x80,0x00); //green lcd
+                        LCD.locate(0,1);         //position for writing
+                        printf(buf,"ARM ALARM  2");
+                        
+                        LCD.locate(1,1);              //position next line
+                        printf(buf,"ALARM OFF  4");
+                        
+                                    break;
+                        case '2': 
+                        LCD.clear();
+                        LCD.setRGB(0xff,0x00,0x00); //lcd red
+                        LCD.locate(0,1);
+                        printf(buf,"ALARM is ARMING");
+                        printf(buf,"please leave Now");
+                        
+                        display.setBrightness(3);   //brightness
+                        for (int count=10;count >0;count-- ) // count for 10 sec
+                        {
+                         display.write(count);
+                         wait(1000);
+                         }
+                         
+                        LCD.setRGB(0x00,0x80,0x00);     //lcd green
+                        PIR.fall(&LOW);                         // connect code at LOW to IRQ
+         
+        if(motion_detected == 1)            // if motion detected
+        {
+            motion_detected=0;       // set variable to 0
+            for(int Flash =0 ;Flash >5;Flash++){
+            flash.setRGB(0xff,0xff,0xff);  // set LCD to white
+             wait_ms(500);
+            flash.setRGB(0xff,0x00,0x00); 
+            }                               // set lcd to red // hold red colour for 0.5 seconds
+              LCD.setRGB(0x80,0x00,0x80);
+            printf(buf,"Alarm Sounding ");
+            LCD.locate(1,1);
+            printf(buf,"3 Disable ALarm");
+            
+        }
+                          
+                         break;
+                         
+                          
+                        
+                        case '3': 
+                        LCD.clear();
+                        LCD.setRGB(0x00,0x80,0x00);
+                        LCD.locate(0,1);
+                        printf(buf," ALARM DISARMED");
+                        LCD.locate(1,1);
+                        printf(buf,"2- ARM,   4- OFF");
+                       // DigitDisplay::off();
+                        
+                          
+                        case '4':  
+                        LCD.setRGB(0x80,0x00,0x80);
+                        LCD.locate(0,1);
+                        printf(buf," ALARM IS about ");
+                        LCD.locate(1,1);
+                        printf(buf,"to Turn OFF ");
+                         wait_ms(2000);
+                         void displayOff();
+                                    break;
+                        
+                        default:    
+                                    
+                                    break;
+                                    
+                    }
+                }
+            }
+        }
+
+
+void LOW(void)
+{
+   motion_detected=1;                       // motion_detected ==1 motion
+} 
\ No newline at end of file
diff -r 000000000000 -r 1e3da2405347 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Apr 07 17:37:11 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc
\ No newline at end of file