Lum_sensor usage with DISCO_L476VG
Dependencies: BSP_DISCO_L476VG LCD_DISCO_L476VG
main.cpp@0:eefb178c8df7, 2020-04-01 (annotated)
- Committer:
- cedric_jefferson
- Date:
- Wed Apr 01 11:55:19 2020 +0000
- Revision:
- 0:eefb178c8df7
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cedric_jefferson | 0:eefb178c8df7 | 1 | #include "mbed.h" |
cedric_jefferson | 0:eefb178c8df7 | 2 | #include "LCD_DISCO_L476VG.h" |
cedric_jefferson | 0:eefb178c8df7 | 3 | |
cedric_jefferson | 0:eefb178c8df7 | 4 | LCD_DISCO_L476VG lcd; |
cedric_jefferson | 0:eefb178c8df7 | 5 | |
cedric_jefferson | 0:eefb178c8df7 | 6 | DigitalOut led_green(LED1); |
cedric_jefferson | 0:eefb178c8df7 | 7 | |
cedric_jefferson | 0:eefb178c8df7 | 8 | int main() |
cedric_jefferson | 0:eefb178c8df7 | 9 | { |
cedric_jefferson | 0:eefb178c8df7 | 10 | uint8_t DisplayedString[7] = {0}; |
cedric_jefferson | 0:eefb178c8df7 | 11 | uint8_t title[] = " DISCOVERY STM32L476"; |
cedric_jefferson | 0:eefb178c8df7 | 12 | |
cedric_jefferson | 0:eefb178c8df7 | 13 | printf("\nHello\n"); |
cedric_jefferson | 0:eefb178c8df7 | 14 | led_green = 1; |
cedric_jefferson | 0:eefb178c8df7 | 15 | lcd.Clear(); |
cedric_jefferson | 0:eefb178c8df7 | 16 | lcd.DisplayString((uint8_t *)"HELLO"); |
cedric_jefferson | 0:eefb178c8df7 | 17 | ThisThread::sleep_for(5000); |
cedric_jefferson | 0:eefb178c8df7 | 18 | led_green = 0; |
cedric_jefferson | 0:eefb178c8df7 | 19 | |
cedric_jefferson | 0:eefb178c8df7 | 20 | while(1) { |
cedric_jefferson | 0:eefb178c8df7 | 21 | printf("Scroll sequence\n"); |
cedric_jefferson | 0:eefb178c8df7 | 22 | lcd.Clear(); |
cedric_jefferson | 0:eefb178c8df7 | 23 | lcd.ScrollSentence(title, 1, 400); |
cedric_jefferson | 0:eefb178c8df7 | 24 | lcd.Clear(); |
cedric_jefferson | 0:eefb178c8df7 | 25 | led_green = !led_green; |
cedric_jefferson | 0:eefb178c8df7 | 26 | |
cedric_jefferson | 0:eefb178c8df7 | 27 | for(uint32_t BarNumber = 0; BarNumber <= 4; BarNumber++) { |
cedric_jefferson | 0:eefb178c8df7 | 28 | printf("BAR = %d\n", BarNumber); |
cedric_jefferson | 0:eefb178c8df7 | 29 | sprintf((char *)DisplayedString, "BAR %d", BarNumber); |
cedric_jefferson | 0:eefb178c8df7 | 30 | lcd.DisplayString(DisplayedString); |
cedric_jefferson | 0:eefb178c8df7 | 31 | lcd.BarLevelConfig((uint8_t)BarNumber); |
cedric_jefferson | 0:eefb178c8df7 | 32 | ThisThread::sleep_for(1000); |
cedric_jefferson | 0:eefb178c8df7 | 33 | } |
cedric_jefferson | 0:eefb178c8df7 | 34 | } |
cedric_jefferson | 0:eefb178c8df7 | 35 | } |