For team basic frame work
Dependencies: mbed
Revision 6:54991513b762, committed 2017-03-02
- Comitter:
- fjwats
- Date:
- Thu Mar 02 15:37:30 2017 +0000
- Parent:
- 5:66527172b136
- Commit message:
- Program now compiles. woohoo!
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Mar 02 15:01:36 2017 +0000
+++ b/main.cpp Thu Mar 02 15:37:30 2017 +0000
@@ -23,7 +23,7 @@
int US4_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
int US5_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
-std::string telemFile; // file holding info about telem data gathered since last power on
+std::ofstream stream ("DriveData.txt");; // file object for holding info about telem data gathered since last power on
void setActiveUS(int chan);
@@ -63,31 +63,29 @@
// Opens set file for logging, appends some data, then returns.
// This method is only called for speed and heading changes.
void telemUpdate(float steer, float speed) {
- std::ofstream stream;
- stream.open(telemFile, std::ios::app);
- stream << "steer:" << data << " speed:" << speed << "\n";
+ stream << "steer:" << steer << " speed:" << speed << "\n";
}
// Opens set file for logging, appends some data, then returns.
// This method is only called for ambient temperature readings.
void telemUpdate(float temp) {
- std::ofstream stream;
- stream.open(telemFile, std::ios::app);
stream << "temp:" << temp << "\n";
}
// Alters the cars steering angle based on the float passed to it.
// Float s is valued between -1 and +1. ERRONEOUS VALUES ARE IGNORED.
void turnWheels(float s) {
- if (s++>=0&&s<=2) {steer.pulsewidth(s/2000+0.001}} // This is Nicolae's code, simplified and included by Frank
- telemUpdate()
+ if (s++>=0&&s<=2) {
+ steer.pulsewidth(s/2000+0.001);
+ } // This is Nicolae's code, simplified and included by Frank
+ telemUpdate(0.0);
}
// Alters the cars velocity based on the float passed to it.
// Float s is valued between -1 and +1. ERRONEOUS VALUES ARE IGNORED.
void setSpeed(float s) {
- 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
+ if (s++>=0&&s<=2) {speed.pulsewidth(s/2000+0.001);} // THIS CODE IS NOT VERY GOOD and will not work without changes
+ telemUpdate(0.0); // Someone who knows how PWM works - fix this please
}