aaaaa
Dependencies: mbed Grove_LCD_RGB_Backlight
Diff: lab4b.cpp
- Revision:
- 2:8bb42c039d39
- Parent:
- 1:d800035aa2d9
diff -r d800035aa2d9 -r 8bb42c039d39 lab4b.cpp --- a/lab4b.cpp Thu Oct 08 17:51:31 2020 +0000 +++ b/lab4b.cpp Wed Mar 09 20:31:19 2022 +0000 @@ -1,42 +1,8 @@ -/* -Title: Using Pushbuttons to selectively blink a RED/Green Led -Author: Your Name,Student Id, Course Code, Lab Section -Date: Today's Date -Description: This program will turn ON/OFF the red led if the - left pushbutton is pressed or the green led if the - right pushbutton is pressed. -*/ - -#include "mbed.h" // include the mbed library - -DigitalOut led_red(LED_RED); // led_red is set to RED LED pin -DigitalOut led_green(LED_GREEN); // led_green is set to GREEN LED pin -DigitalIn left_pb(SW3); // left_pb is set to left pb pin -DigitalIn right_pb(SW2); // right pb is set to right pb pin - -int main() +#include "Grove_LCD_RGB_Backlight.h" +#include "mbed.h" +int main(void) { - led_red=led_green=1; // turn red and green leds off - for(;;) - { - if(left_pb==1) // if left pb is pressed - { - led_red=1; // red led is off - wait_ms(500); - led_red=0; // red led is on - wait_ms(500); - } - else - if(right_pb==1) // else if rigth pb is pressed - { - led_green=1; // green led is off - wait_ms(500); - led_green=0; // green led is on - wait_ms(500); - } - else - { - led_red=led_green=1; // turn red and green leds off - } - } -} + Grove_LCD_RGB_Backlight lcd(D14, D15); + lcd.print("Hello World"); + for(;;); +} \ No newline at end of file