a controller for a furuta pendulum
Dependencies: QEI mbed-rtos mbed
Revision 7:59613b7a1631, committed 2013-12-04
- Comitter:
- jaoramos
- Date:
- Wed Dec 04 01:49:01 2013 +0000
- Parent:
- 6:16da0de99a8c
- Child:
- 8:57c2b7c94ce8
- Commit message:
- working before adding moving average
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Dec 03 16:47:34 2013 +0000
+++ b/main.cpp Wed Dec 04 01:49:01 2013 +0000
@@ -14,7 +14,7 @@
#define BUFFER_SIZE 4200
#define MAX_VOLTAGE 3.3
#define VOLTS_PER_AMP 0.14
-
+#define PROGRAM_RUNTIME 15.0
Serial pc(USBTX, USBRX);
@@ -55,7 +55,7 @@
void saving(void const *args) {
index = 0;
- while ((index < BUFFER_SIZE)&&(flag == 1)) {
+ while ((index < BUFFER_SIZE)&&(flag == 1)&&(false)) {
buffer[index] = theta1;
buffer[index+1] = theta2;
buffer[index+2] = dtheta1;
@@ -86,7 +86,7 @@
void computing(void const *args) {
float z1 = 0.0, z2 = 0.0, dz1 = 0.0, dz2 = 0.0, z3 = 0.0, dz3 = 0.0;
- while (true) {
+ while (true ) {
t = T.read();
//set pwm
@@ -170,7 +170,7 @@
pc.printf("Start!\r\n");
pc.printf("Time: %f\r\n", t);
- while (t < 10.0)
+ while (t < PROGRAM_RUNTIME)
{
//pc.printf("Time: %f\r\n", t);
Thread::wait(1000);