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