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

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

main.cpp

Committer:
syundo0730
Date:
2012-09-21
Revision:
8:72b4a248d469
Parent:
Source3.cpp@ 7:7c0621d33781
Child:
9:d9ce965299d2

File content as of revision 8:72b4a248d469:

#include "LPC17xx.h"
#include "mbed.h"
#include "pwm.h"
#include <cmath>
#define M_PI 3.141592653589793238462643383279

void main_th(void);
//PWM pwm;

int main(void)
{  
    PWM pwm;
    Ticker flip;
    
    pwm.InitPWM();
    flip.attach(&main_th,0.02);
    
    while (1) {
        //SetDuty(1,SRV_MAX_DUTY);
        //sleep();
        //__enable_irq();
        //__disable_irq();
        //NVIC_DisableIRQ(PWM1_IRQn);
    }
}

void main_th(void) {
    PWM pwm;
    //const uint32_t center = 1500 - 1;
    //const uint32_t dif = SRV_MAX_DUTY - center;
    static uint8_t i;
    
    __disable_irq();
    pwm.SetDuty(1,SRV_MIN_DUTY+i);
    __enable_irq();
    ++i;
}