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.
Diff: m3pi.h
- Revision:
- 9:074ce6197b51
- Parent:
- 4:0abe81f5d9fd
- Child:
- 10:0dec82280040
diff -r 92167bd3eb44 -r 074ce6197b51 m3pi.h
--- a/m3pi.h Wed Jul 05 14:39:33 2017 +0000
+++ b/m3pi.h Mon Mar 19 13:06:40 2018 +0000
@@ -28,6 +28,11 @@
* @details code and start 3pi in serial slave mode
*/
void init();
+
+ /** Causes the robot to read the IR sensors
+ * @details is an alterative to get_*_values methods if you don't need the values themselves
+ */
+ void scan();
/** Get signature of slave firmware
* @param signature - array of size 7 to store signature
@@ -75,6 +80,14 @@
* @details 0.0 for line under sensor 2, 0.5 for line under sensor 3 etc.
*/
float get_line_position();
+
+ /** Returns an estimate of the normalised line position
+ * @returns float in the range -1.0 to 1.0
+ * @details uses the values of sensor stored in the class - must call scan() first!
+ * @details -1.0 for line under sensor 0, -0.5 for line under sensor 1
+ * @details 0.0 for line under sensor 2, 0.5 for line under sensor 3 etc.
+ */
+ float read_line();
/** Clear LCD
*/
@@ -148,6 +161,11 @@
*/
void display_signature(int x,int y);
+ /** Display line position and bar graph of sensor readings on LCD
+ * @details must call scan() and read_line() first
+ */
+ void display_data();
+
/** Display sensor values on LCD
* @param values - array of calibrated sensor values
* @param y - line on LCD to display
@@ -175,6 +193,7 @@
float _last_line_position;
char _bar_graph[7];
+ unsigned int _values[5];
void reset();