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: mbed
Diff: main.cpp
- Revision:
- 5:66527172b136
- Parent:
- 4:54544a7dcbe0
- Child:
- 6:54991513b762
diff -r 54544a7dcbe0 -r 66527172b136 main.cpp
--- a/main.cpp Fri Feb 17 01:34:30 2017 +0000
+++ b/main.cpp Thu Mar 02 15:01:36 2017 +0000
@@ -27,26 +27,6 @@
void setActiveUS(int chan);
-int getPing();
-
-int main() {
- int iCount = 0;
- int measured = 0;
-
- while(iCount <= 5){
- setActiveUS(iCount);
- measured = getPing();
- rawUS_data[iCount] = measured;
- }
-
- US1_mean[0]=rawUS_data[0];
- US2_mean[0]=rawUS_data[1];
- US3_mean[0]=rawUS_data[2];
- US4_mean[0]=rawUS_data[3];
- US5_mean[0]=rawUS_data[4];
-
-}
-
void setActiveUS(int chan){
switch(chan){
case 0:
@@ -93,7 +73,7 @@
void telemUpdate(float temp) {
std::ofstream stream;
stream.open(telemFile, std::ios::app);
- stream << "temp: " << temp << "\n";
+ stream << "temp:" << temp << "\n";
}
// Alters the cars steering angle based on the float passed to it.
@@ -109,3 +89,22 @@
if (s++>=0&&s<=2) {speed.pulsewidth(s/2000+0.001)} // THIS CODE IS NOT VERY GOOD and will not work without changes
telemUpdate() // Someone who knows how PWM works - fix this please
}
+
+
+int main() {
+ int iCount = 0;
+ int measured = 0;
+
+ while(iCount <= 5){
+ setActiveUS(iCount);
+ measured = getPing();
+ rawUS_data[iCount] = measured;
+ }
+
+ US1_mean[0]=rawUS_data[0];
+ US2_mean[0]=rawUS_data[1];
+ US3_mean[0]=rawUS_data[2];
+ US4_mean[0]=rawUS_data[3];
+ US5_mean[0]=rawUS_data[4];
+
+}