Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.

Dependencies:   Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed

Committer:
syundo0730
Date:
Fri Sep 21 03:44:37 2012 +0000
Revision:
8:72b4a248d469
Parent:
Source3.cpp@7:7c0621d33781
Child:
9:d9ce965299d2
multi_2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
syundo0730 0:d114194bff43 1 #include "LPC17xx.h"
syundo0730 0:d114194bff43 2 #include "mbed.h"
syundo0730 7:7c0621d33781 3 #include "pwm.h"
syundo0730 8:72b4a248d469 4 #include <cmath>
syundo0730 8:72b4a248d469 5 #define M_PI 3.141592653589793238462643383279
syundo0730 0:d114194bff43 6
syundo0730 5:0ca9f1bc1fb0 7 void main_th(void);
syundo0730 8:72b4a248d469 8 //PWM pwm;
syundo0730 5:0ca9f1bc1fb0 9
syundo0730 8:72b4a248d469 10 int main(void)
syundo0730 8:72b4a248d469 11 {
syundo0730 8:72b4a248d469 12 PWM pwm;
syundo0730 8:72b4a248d469 13 Ticker flip;
syundo0730 0:d114194bff43 14
syundo0730 8:72b4a248d469 15 pwm.InitPWM();
syundo0730 8:72b4a248d469 16 flip.attach(&main_th,0.02);
syundo0730 1:5c2e40445778 17
syundo0730 5:0ca9f1bc1fb0 18 while (1) {
syundo0730 5:0ca9f1bc1fb0 19 //SetDuty(1,SRV_MAX_DUTY);
syundo0730 5:0ca9f1bc1fb0 20 //sleep();
syundo0730 8:72b4a248d469 21 //__enable_irq();
syundo0730 8:72b4a248d469 22 //__disable_irq();
syundo0730 8:72b4a248d469 23 //NVIC_DisableIRQ(PWM1_IRQn);
syundo0730 5:0ca9f1bc1fb0 24 }
syundo0730 5:0ca9f1bc1fb0 25 }
syundo0730 5:0ca9f1bc1fb0 26
syundo0730 5:0ca9f1bc1fb0 27 void main_th(void) {
syundo0730 8:72b4a248d469 28 PWM pwm;
syundo0730 8:72b4a248d469 29 //const uint32_t center = 1500 - 1;
syundo0730 8:72b4a248d469 30 //const uint32_t dif = SRV_MAX_DUTY - center;
syundo0730 8:72b4a248d469 31 static uint8_t i;
syundo0730 8:72b4a248d469 32
syundo0730 8:72b4a248d469 33 __disable_irq();
syundo0730 8:72b4a248d469 34 pwm.SetDuty(1,SRV_MIN_DUTY+i);
syundo0730 8:72b4a248d469 35 __enable_irq();
syundo0730 8:72b4a248d469 36 ++i;
syundo0730 0:d114194bff43 37 }