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: C12832_lcd Pulse RangeFinder Servo mbed-rtos mbed
Fork of Sprint3_Sonar by
Revision 10:5a9a3a5704ef, committed 2015-04-24
- Comitter:
- davidqpinho
- Date:
- Fri Apr 24 10:44:25 2015 +0000
- Parent:
- 9:fa6121cc0fff
- Commit message:
- dsadsa
;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 24 10:16:05 2015 +0000
+++ b/main.cpp Fri Apr 24 10:44:25 2015 +0000
@@ -13,6 +13,7 @@
float sonar_data;
int base_servo_pos = 1000;
+float limit=2;
Servo s1(p21);
@@ -50,9 +51,9 @@
float ajusting_sonardata(float data)
{
- if(data>0.3)
+ if(data>limit)
{
- return 0.3;
+ return limit;
}
else{
return data;
@@ -73,7 +74,7 @@
while (1) {
sonar_data = rf.read_m();
base_servo_Intelligence.lock();
- base_servo_pos = 2200-((1400*ajusting_sonardata(sonar_data)/0.3));
+ base_servo_pos = 800+((1400*ajusting_sonardata(sonar_data)/limit));
base_servo_Intelligence.unlock();
WAITT;
}
