![](/media/cache/profiles/e5815151957be36ad2085b7a1a02c5cc.jpg.50x50_q85.jpg)
Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.
Dependencies: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
Diff: main.cpp
- Revision:
- 9:d9ce965299d2
- Parent:
- 8:72b4a248d469
- Child:
- 10:be8b10e54ecb
--- a/main.cpp Fri Sep 21 03:44:37 2012 +0000 +++ b/main.cpp Sat Sep 22 06:16:15 2012 +0000 @@ -1,19 +1,32 @@ #include "LPC17xx.h" #include "mbed.h" -#include "pwm.h" -#include <cmath> -#define M_PI 3.141592653589793238462643383279 +#include "PWM.h" +#include "Motion.h" -void main_th(void); -//PWM pwm; +Ticker tick; +PWM pwm; int main(void) { - PWM pwm; - Ticker flip; + unsigned char size_x = 4, size_y = 24; - pwm.InitPWM(); - flip.attach(&main_th,0.02); + uint32_t **array = new uint32_t*[size_x]; + for (int i = 0; i < size_x; ++i) { + array[i] = new uint32_t[size_y]; + } + for (int i = 0; i < size_x; ++i) { + for (int j = 0; j < size_y; ++j) { + array[i][j] = 900 + 300 * i; + } + } + array[0][size_y - 1] = 50; + array[1][size_y - 1] = 50; + array[2][size_y - 1] = 50; + array[3][size_y - 1] = 50; + + Motion inter0(array, size_x, size_y); + + tick.attach(&inter0, &Motion::step, 0.02); while (1) { //SetDuty(1,SRV_MAX_DUTY); @@ -24,7 +37,7 @@ } } -void main_th(void) { +/*void main_th(void) { PWM pwm; //const uint32_t center = 1500 - 1; //const uint32_t dif = SRV_MAX_DUTY - center; @@ -34,4 +47,4 @@ pwm.SetDuty(1,SRV_MIN_DUTY+i); __enable_irq(); ++i; -} \ No newline at end of file +}*/ \ No newline at end of file