
c
Dependencies: mbed Grove_LCD_RGB_Backlight
Revision 0:cb2826e4b518, committed 2020-08-27
- Comitter:
- DavidRoss
- Date:
- Thu Aug 27 17:22:29 2020 +0000
- Child:
- 1:734e32694486
- Commit message:
- good version
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Grove_LCD_RGB_Backlight.lib Thu Aug 27 17:22:29 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/cmatz3/code/Grove_LCD_RGB_Backlight/#5ce38ef7a7db
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lab6b.cpp Thu Aug 27 17:22:29 2020 +0000 @@ -0,0 +1,44 @@ +/* + Title: Program to position text on different coloured backgrounds. + Author: Dave Ross + Date: Mar 21st, 2019 + Description: This program will take keyboard input to position + fixed text and to change the colour of screen the + text is displayed on. +*/ + +// Include Section +#include "Grove_LCD_RGB_Backlight.h" // Grove LCD header file +#include "mbed.h" // mbed header file + +// Function Prototype Section +void clear(void); // clears the PC screen +void position(int x, int y); // positions screen cursor at (x,y) + +// Hardware definition Section +Grove_LCD_RGB_Backlight lcd(D14,D15); // lcd is associated with (D14,D15) +AnalogIn pot(A1); // pot is associated with A1 +const int MAX=10; // MAX is dimension of Buffer Array +int main(void) +{ + char buffer[MAX]; // buffer has MAX elements + double voltage; // variable for storing voltage + int i; // variable used to null array + for(i=0;i<=MAX-1;++i) // NULL all elements 0 to MAX-1 + { + buffer[i]=0; // set element to NULL character + } + lcd.clear(); // clear lcd screen + lcd.locate(0,0); // 1st column 1st row + lcd.print("0123456789012345"); // print grid 0-15 + lcd.setRGB(0x00,0x00,0xff); // set background to blue + for(;;) // infinite loop + { + voltage=pot.read(); // voltage reading (0-1) from pot + voltage=3.33*voltage; // scale to 3.33 volts + lcd.locate(3,1); // 4th column 2nd row + sprintf(buffer,"%5.3f",voltage); // voltage to string in buffer + lcd.print(buffer); // print buffer on lcd + wait(0.05); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Aug 27 17:22:29 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file