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 #include "mbed.h" 00002 #include "keyboard.h" 00003 #include <string> 00004 00005 //LORA 00006 00007 Serial pc(USBTX, USBRX); 00008 Serial uart(PA_0, PA_1);//TX4,RX4 00009 int idx= 0; 00010 00011 // define variable for Keyboard input 00012 00013 char getinput1; 00014 char input1; 00015 string inputdata; 00016 00017 00018 void get_data(){ 00019 while(uart.readable()) 00020 { 00021 getinput1 = uart.getc(); 00022 inputdata= getinput1; 00023 pc.printf("%s", inputdata); 00024 00025 } 00026 } 00027 int main(){ 00028 // Lora define 00029 uart.baud(9600); // speed of reading data 00030 00031 // Function of Input keyboard 00032 inputkey(); // print out the request for typing the key 00033 GetkeyInput(); // type input and send to RX lora control DC motor 00034 uart.attach(&get_data); 00035 while(1){ // start with infinite loop 00036 00037 inputkey(); 00038 input1 = GetkeyInput(); 00039 idx= idx+1; 00040 // input keyboard to control the robot 00041 uart.putc( input1); 00042 wait(0.1); 00043 00044 // Reading the input from the Ultrasonic 00045 00046 00047 } 00048 00049 } 00050
Generated on Sun Jul 24 2022 02:35:24 by
1.7.2