Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.
Dependencies: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
Source3.cpp@7:7c0621d33781, 2012-09-18 (annotated)
- Committer:
- syundo0730
- Date:
- Tue Sep 18 16:16:23 2012 +0000
- Revision:
- 7:7c0621d33781
- Parent:
- 5:0ca9f1bc1fb0
multi file
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:d114194bff43 | 4 | |
syundo0730 | 7:7c0621d33781 | 5 | Ticker flip; |
syundo0730 | 5:0ca9f1bc1fb0 | 6 | void main_th(void); |
syundo0730 | 0:d114194bff43 | 7 | |
syundo0730 | 7:7c0621d33781 | 8 | extern volatile uint8_t SRV_Idx; |
syundo0730 | 7:7c0621d33781 | 9 | extern volatile uint32_t SRV_dutyTable[SRV_BANK_NUM][SRV_IDX_NUM]; |
syundo0730 | 5:0ca9f1bc1fb0 | 10 | |
syundo0730 | 0:d114194bff43 | 11 | int main(void) { |
syundo0730 | 0:d114194bff43 | 12 | |
syundo0730 | 0:d114194bff43 | 13 | for(int i = 0; i < SRV_CH_NUM; i++) |
syundo0730 | 0:d114194bff43 | 14 | { |
syundo0730 | 0:d114194bff43 | 15 | SetDuty(i, (SRV_MAX_DUTY + SRV_MIN_DUTY) / 2); |
syundo0730 | 0:d114194bff43 | 16 | } |
syundo0730 | 0:d114194bff43 | 17 | |
syundo0730 | 1:5c2e40445778 | 18 | Init_PWM(); |
syundo0730 | 5:0ca9f1bc1fb0 | 19 | flip.attach(&main_th,5.0); |
syundo0730 | 1:5c2e40445778 | 20 | |
syundo0730 | 5:0ca9f1bc1fb0 | 21 | while (1) { |
syundo0730 | 5:0ca9f1bc1fb0 | 22 | //SetDuty(1,SRV_MAX_DUTY); |
syundo0730 | 5:0ca9f1bc1fb0 | 23 | //sleep(); |
syundo0730 | 5:0ca9f1bc1fb0 | 24 | } |
syundo0730 | 5:0ca9f1bc1fb0 | 25 | } |
syundo0730 | 5:0ca9f1bc1fb0 | 26 | |
syundo0730 | 5:0ca9f1bc1fb0 | 27 | void main_th(void) { |
syundo0730 | 5:0ca9f1bc1fb0 | 28 | SetDuty(1,0); |
syundo0730 | 0:d114194bff43 | 29 | } |