HC05 F103 Offenburg

Dependencies:   LCD_i2c_GSOE_Schnaiter

Committer:
jack1930
Date:
Wed Aug 18 14:54:54 2021 +0000
Revision:
0:b066c69766c8
Schnaiter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jack1930 0:b066c69766c8 1 /* mbed Microcontroller Library
jack1930 0:b066c69766c8 2 * Copyright (c) 2019 ARM Limited
jack1930 0:b066c69766c8 3 * SPDX-License-Identifier: Apache-2.0
jack1930 0:b066c69766c8 4 */
jack1930 0:b066c69766c8 5
jack1930 0:b066c69766c8 6 #include "mbed.h"
jack1930 0:b066c69766c8 7 #include "platform/mbed_thread.h"
jack1930 0:b066c69766c8 8 #include "LCD.h"
jack1930 0:b066c69766c8 9 #include <Callback.h>
jack1930 0:b066c69766c8 10
jack1930 0:b066c69766c8 11 // Blinking rate in milliseconds
jack1930 0:b066c69766c8 12 #define BLINKING_RATE_MS 500
jack1930 0:b066c69766c8 13
jack1930 0:b066c69766c8 14 BufferedSerial hc05(PB_10,PB_11,9600);
jack1930 0:b066c69766c8 15 DigitalOut links1(PA_8);
jack1930 0:b066c69766c8 16 DigitalOut links2(PA_9);
jack1930 0:b066c69766c8 17 DigitalOut rechts1(PA_10);
jack1930 0:b066c69766c8 18 DigitalOut rechts2(PA_11);
jack1930 0:b066c69766c8 19 lcd mylcd;
jack1930 0:b066c69766c8 20 char c;
jack1930 0:b066c69766c8 21
jack1930 0:b066c69766c8 22
jack1930 0:b066c69766c8 23
jack1930 0:b066c69766c8 24 int main()
jack1930 0:b066c69766c8 25 {
jack1930 0:b066c69766c8 26 char daten[6];
jack1930 0:b066c69766c8 27
jack1930 0:b066c69766c8 28 mylcd.clear();
jack1930 0:b066c69766c8 29 while (true) {
jack1930 0:b066c69766c8 30 if (hc05.readable())
jack1930 0:b066c69766c8 31 {
jack1930 0:b066c69766c8 32 hc05.read(daten,1);
jack1930 0:b066c69766c8 33 mylcd.cursorpos(0x40);
jack1930 0:b066c69766c8 34 mylcd.printf("%d",daten[0]);
jack1930 0:b066c69766c8 35 switch(daten[0])
jack1930 0:b066c69766c8 36 {
jack1930 0:b066c69766c8 37 case 'U':links1=1;links2=0;break;
jack1930 0:b066c69766c8 38 case 'X':links1=0;links2=0;break;
jack1930 0:b066c69766c8 39 case 'D':links1=0;links2=1;break;
jack1930 0:b066c69766c8 40 case 'V':rechts2=1;rechts1=0;break;
jack1930 0:b066c69766c8 41 case 'Y':rechts2=0;rechts1=0;break;
jack1930 0:b066c69766c8 42 case 'E':rechts2=0;rechts1=1;break;
jack1930 0:b066c69766c8 43 case 'W':links1=1;links2=0;rechts2=1;rechts1=0;break;
jack1930 0:b066c69766c8 44 case 'Z':links1=0;links2=0;rechts2=0;rechts1=0;break;
jack1930 0:b066c69766c8 45 case 'F':links1=0;links2=1;rechts2=0;rechts1=1;break;
jack1930 0:b066c69766c8 46 }
jack1930 0:b066c69766c8 47 }
jack1930 0:b066c69766c8 48 //thread_sleep_for(BLINKING_RATE_MS);
jack1930 0:b066c69766c8 49 }
jack1930 0:b066c69766c8 50 }