mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 09:21:12 +03:00
hcsr04: fixes driver and addresses issue #207
Signed-off-by: Rafael Neri <rafael.neri@gmail.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
0bc1930cf5
commit
5a62602a11
@ -18,7 +18,7 @@ add_executable (nrf24l01-transmitter-example nrf24l01-transmitter.cxx)
|
||||
add_executable (nrf24l01-receiver-example nrf24l01-receiver.cxx)
|
||||
add_executable (nrf24l01-broadcast-example nrf24l01-broadcast.cxx)
|
||||
add_executable (es08a-example es08a.cxx)
|
||||
add_executable (son-hcsr04-example hcsr04.cxx)
|
||||
add_executable (hcsr04-example hcsr04.cxx)
|
||||
add_executable (ssd1308-oled-example ssd1308-oled.cxx)
|
||||
add_executable (ssd1327-oled-example ssd1327-oled.cxx)
|
||||
add_executable (max44000-example max44000.cxx)
|
||||
@ -269,7 +269,7 @@ target_link_libraries (nrf24l01-transmitter-example nrf24l01 ${CMAKE_THREAD_LIBS
|
||||
target_link_libraries (nrf24l01-receiver-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (nrf24l01-broadcast-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (es08a-example servo ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (son-hcsr04-example hcsr04 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (hcsr04-example hcsr04 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ssd1308-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ssd1327-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (max44000-example max44000 ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
@ -50,11 +50,17 @@ interrupt (void * args) {
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
sonar = new upm::HCSR04(5, 7, &interrupt);
|
||||
sonar = new upm::HCSR04(5, 6, &interrupt);
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
printf ("width = %d\n", sonar->getDistance());
|
||||
std::cout << "exiting application" << std::endl;
|
||||
sleep(1);
|
||||
|
||||
for(;;){
|
||||
std::cout << "get distance" << std::endl;
|
||||
double distance = sonar->getDistance(CM);
|
||||
std::cout << "distance " << distance << std::endl;
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
delete sonar;
|
||||
|
||||
|
Reference in New Issue
Block a user