Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 */ 00005 00006 #include "mbed.h" 00007 #include "LCD.h" 00008 00009 00010 // Blinking rate in milliseconds 00011 #define BLINKING_RATE 20ms 00012 BufferedSerial hc05(PB_10,PB_11,9600); 00013 DigitalOut a(PC_0); 00014 DigitalOut b(PC_1); 00015 DigitalOut c(PC_2); 00016 DigitalOut d(PC_3); 00017 00018 DigitalIn l(PB_0); 00019 DigitalIn m(PB_3); 00020 DigitalIn n(PB_4); 00021 00022 lcd mylcd; 00023 00024 int main() 00025 { 00026 char daten[15]; 00027 l.mode(PullDown); 00028 m.mode(PullDown); 00029 n.mode(PullDown); 00030 int altL=0,altM=0,altN=0; 00031 int anz; 00032 00033 // Initialise the digital pin LED1 as an output 00034 DigitalOut led(LED1); 00035 mylcd.clear(); 00036 mylcd.cursorpos(0); 00037 while (true) { 00038 led = !led; 00039 if (l==1&&altL==0)hc05.write("*LR255G0B0*",11); 00040 if (m==1&&altM==0)hc05.write("*MR0G255B0*",11); 00041 if (n==1&&altN==0)hc05.write("*NRG0B255*",11); 00042 if (l==0&&altL==1)hc05.write("*LR0G0B0*",9); 00043 if (m==0&&altM==1)hc05.write("*MR0G0B0*",9); 00044 if (n==0&&altN==1)hc05.write("*NR0G0B0*",9); 00045 altL=l; 00046 altM=m; 00047 altN=n; 00048 if (hc05.readable()) 00049 { 00050 ThisThread::sleep_for(BLINKING_RATE); 00051 anz=hc05.read(daten,15); 00052 for (int i=0;i<anz;i++) 00053 { 00054 if (daten[i]=='A') a=1; 00055 if (daten[i]=='B') b=1; 00056 if (daten[i]=='C') c=1; 00057 if (daten[i]=='D') d=1; 00058 if (daten[i]=='a') a=0; 00059 if (daten[i]=='b') b=0; 00060 if (daten[i]=='c') c=0; 00061 if (daten[i]=='d') d=0; 00062 00063 00064 } 00065 00066 } 00067 ThisThread::sleep_for(BLINKING_RATE); 00068 } 00069 }
Generated on Mon Oct 24 2022 19:04:26 by
1.7.2