APS de Sistemas Operacionais / Controle 2

Dependencies:   mbed-rtos mbed HC_SR04_Ultrasonic_Library

Files at this revision

API Documentation at this revision

Comitter:
feupos
Date:
Mon Oct 30 23:34:06 2017 +0000
Parent:
0:8d53c4c11953
Commit message:
teste

Changed in this revision

HC_SR04_Ultrasonic_Library.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8d53c4c11953 -r c07ed2436cd8 HC_SR04_Ultrasonic_Library.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC_SR04_Ultrasonic_Library.lib	Mon Oct 30 23:34:06 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ejteb/code/HC_SR04_Ultrasonic_Library/#e0f9c9fb4cf3
diff -r 8d53c4c11953 -r c07ed2436cd8 main.cpp
--- a/main.cpp	Sat Oct 21 21:13:13 2017 +0000
+++ b/main.cpp	Mon Oct 30 23:34:06 2017 +0000
@@ -1,14 +1,17 @@
 #include "mbed.h"
 #include "rtos.h"
+ #include "ultrasonic.h"
 
 DigitalOut led1(LED1);
 InterruptIn sw2(SW2);
 uint32_t button_pressed;
 Thread *thread2;
+ultrasonic us = ultrasonic(PTC2, PTC3, 100, 1000);
 
 void sw2_press(void)
 {
     thread2->signal_set(0x1);
+    
 }
 
 void led_thread(void const *argument)
@@ -23,6 +26,8 @@
 {
     while (true) {
         Thread::signal_wait(0x1);
+        float x = us.getCurrentDistance();
+        printf("distance = %f\n", x);
         button_pressed++;
     }
 }
@@ -31,6 +36,7 @@
 {
     Thread thread(led_thread);
     thread2 = new Thread(button_thread);
+    //teste
 
     button_pressed = 0;
     sw2.fall(&sw2_press);