![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Not finished. This is my first attemp to make an autonomous vehicle for the Sparkfun Autonomous Competition (https://avc.sparkfun.com/) of June 2015.
Dependencies: FXOS8700CQ SDFileSystem mbed
Fork of AVC_Robot_Controled_Navigation by
- For my autonomous robot I will use a GPS, magnometer, accelerometer, and encoders.
- I control my robot with a remote control to save the GPS points (detect turns) using a xBee radio and save them to a file in a SD card.
my_libraries/ultrasonic.cpp
- Committer:
- gerardo_carmona
- Date:
- 2014-11-07
- Revision:
- 5:b384cf06de76
- Parent:
- 4:c60636c95b80
File content as of revision 5:b384cf06de76:
// ----- Libraries ------------------------------------------------------------------ #include "mbed.h" #include "ultrasonic.h" // ----- Constants ------------------------------------------------------------------ // ----- I/O Pins ------------------------------------------------------------------- AnalogIn ultra_lef(A2); AnalogIn ultra_rig(A3); // ----- Others --------------------------------------------------------------------- // ----- Variables ------------------------------------------------------------------ double read_sensor, cm; // ----- Functions ------------------------------------------------------------------ float ultrasonicos(int sensor){ double inch, volts; if (sensor == ULTRA_R) { read_sensor = ultra_rig; // read analog as a float }else if (sensor == ULTRA_L) { read_sensor = ultra_lef; // read analog as a float } // read_sensor * 3300mv / 6.4 mV/in * 2.54 in/cms volts = read_sensor * 3300; inch = volts / 6.4; cm = inch * 2.54; return cm; }