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 "SRF02.h" 00003 00004 00005 Serial debugport(USBTX,USBRX); 00006 SRF02 mySensor(p9,p10,0xE0); 00007 00008 00009 00010 00011 main() { 00012 00013 time_t seconds = time(NULL); //Internal RTC 00014 debugport.baud(115200); //set the buadrate (default is 9600 if this command is not used) 00015 debugport.format(8,Serial::None,1); //config the serial port (default is 8N1) 00016 debugport.printf("Hello World! %d \r\n", seconds); //send a message out of the serial port to check all is well 00017 //include a time stamp for reference (seconds since power up) 00018 00019 00020 while (1) { 00021 00022 00023 debugport.printf("current distance: %.2f cm.\r\n", mySensor.distancecm()); 00024 debugport.printf("current distance: %.2f inches.\r\n", mySensor.distancein()); 00025 debugport.printf("current flightime: %.2f microseconds.\r\n", mySensor.distanceus()); 00026 00027 } 00028 }
Generated on Sat Jul 16 2022 00:17:20 by
1.7.2