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.
Revision 7:6efd4f07ae00, committed 2019-03-09
- Comitter:
- lamoreauxaj
- Date:
- Sat Mar 09 22:17:08 2019 +0000
- Parent:
- 6:8ec7a4489a67
- Parent:
- 5:12eddb3cacc9
- Commit message:
- k
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/constants.h Sat Mar 09 22:17:08 2019 +0000 @@ -0,0 +1,6 @@ +#ifndef CONST_H +#define CONST_H + +#define USE_MOTOR true + +#endif \ No newline at end of file
--- a/main.cpp Sat Mar 09 22:13:29 2019 +0000
+++ b/main.cpp Sat Mar 09 22:17:08 2019 +0000
@@ -16,13 +16,12 @@
if (currTime - lastStatusUpdate > 1) {
lastStatusUpdate = currTime;
pc.printf("Battery Voltage: %.2f\r\n", batteryVoltage);
-// fout << "Hello world!\n";
}
}
void updateBattery (float delta, float currTime) {
- float maxVoltage = 7.2f;
+ float maxVoltage = 3.0f;
batteryVoltage = TFC_ReadBatteryVoltage();
float fractionCharged = TFC_ReadBatteryVoltage() / maxVoltage;
@@ -34,11 +33,12 @@
TFC_SetBatteryLED_Level(level);
}
+
void update(float delta, float currTime) {
// pc.printf("Camera1: %d; Camera2 %d\r\n", camera1.read(), camera2.read());
TFC_HBRIDGE_ENABLE;
-// TFC_SetMotorPWM(0.0f, 0.0f);
-// TFC_SetServo(0, 0);
+ TFC_SetMotorPWM(0.2f, 0.2f);
+ TFC_SetServo(0, 0);
updateBattery(delta, currTime);
updateStatus(delta, currTime);
--- a/mbed_app.json Sat Mar 09 22:13:29 2019 +0000
+++ b/mbed_app.json Sat Mar 09 22:17:08 2019 +0000
@@ -7,8 +7,5 @@
"platform.thread-stats-enabled": true,
"platform.sys-stats-enabled": true
}
- },
- "macros": [
- "NODEBUG=1"
- ]
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/repeater.h Sat Mar 09 22:17:08 2019 +0000
@@ -0,0 +1,26 @@
+#ifndef REPEATER_H
+#define REPEATER_H
+
+struct Repeater {
+ double time, lastTime, step;
+
+ Repeater (double s) {
+ lastTime = time = 1.0 * clock() / CLOCKS_PER_SEC;
+ step = s;
+ }
+
+ bool check () {
+ update();
+ if (time >= lastTime + step) {
+ lastTime = time;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ void update () {
+ time = 1.0 * clock() / CLOCKS_PER_SEC;
+ }
+};
+
+#endif
\ No newline at end of file
