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: Movement mbed tunes motor pwm_tone clickers Ultra
Diff: main.cpp
- Revision:
- 13:13f14a8a902b
- Parent:
- 12:15272c2ae2ed
- Child:
- 15:f64e77f45a3d
diff -r 15272c2ae2ed -r 13f14a8a902b main.cpp
--- a/main.cpp Tue Mar 17 13:13:57 2020 +0000
+++ b/main.cpp Tue Mar 17 15:22:54 2020 +0000
@@ -34,10 +34,10 @@
Serial pc(USBTX,USBRX); //Instance of the Serial class to enable much faster BAUD rates then standard 9600 i.e. 115200
//This is Pseudo RS232 over USB the NUCLEO will appear as a COMx Port see device Manager on PC used
//Use PuTTY to monitor check COMx and BAUD rate (115200)
-int mm;
-int HallState = 0;
-bool fStopped, rStopped = false;
-void dist(){
+int mm; //This variable will hold the distance in mm between the buggy and the object infront of it
+bool fStopped, rStopped = false;// these variables are used to determine weather the buggy has been stopped, either from going forwards or backwards
+
+void dist(){//This function will get the distance in mm and set the mm variable to this value
ultra_sonic_distance();
mm = (int)GetDistance();
}
@@ -64,6 +64,6 @@
while(true) //Repeat the following forever NB always true!
{
- Direction();
+ Direction();// run the Direction function in the Movement library
} // go back to start of while loop
} //end of int main()