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.
Dependencies: mbed
Fork of TestBed-LCD20x4 by
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 DigitalIn echo(p18); 00004 DigitalOut trigger(p17); 00005 TextLCD lcd(p26, p25, p24, p23, p22, p20, p19, TextLCD::LCD20x4); 00006 00007 Timer t; 00008 float i; 00009 00010 int main() { 00011 //Testen van het scherm 00012 lcd.printf("--UltraSonic Range--"); 00013 wait(1); 00014 lcd.cls(); 00015 00016 t.start(); 00017 while(1) { 00018 //Pulstrein 00019 trigger=1; 00020 wait(0.00004); 00021 trigger=0; 00022 while(!echo); 00023 00024 t.reset(); 00025 while(echo); 00026 i=t.read_us(); 00027 00028 lcd.cls(); 00029 lcd.printf("Pulse length= \n%6.0f us", i); 00030 i=i/58.479; 00031 lcd.printf("\nDistance = %4.1f cm", i); 00032 wait(0.2); 00033 } 00034 }
Generated on Wed Jul 13 2022 07:16:46 by
1.7.2
