![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This is for ICRS\' second generation Quadcopter
main_init.h@0:0bbf2f16da9c, 2011-11-18 (annotated)
- Committer:
- madcowswe
- Date:
- Fri Nov 18 18:23:33 2011 +0000
- Revision:
- 0:0bbf2f16da9c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
madcowswe | 0:0bbf2f16da9c | 1 | |
madcowswe | 0:0bbf2f16da9c | 2 | |
madcowswe | 0:0bbf2f16da9c | 3 | void main_init() { |
madcowswe | 0:0bbf2f16da9c | 4 | |
madcowswe | 0:0bbf2f16da9c | 5 | //Emergency stop button |
madcowswe | 0:0bbf2f16da9c | 6 | Nkill.mode(PullDown); |
madcowswe | 0:0bbf2f16da9c | 7 | |
madcowswe | 0:0bbf2f16da9c | 8 | pc.printf("Hello World!\r\n"); |
madcowswe | 0:0bbf2f16da9c | 9 | |
madcowswe | 0:0bbf2f16da9c | 10 | initmotor(); |
madcowswe | 0:0bbf2f16da9c | 11 | |
madcowswe | 0:0bbf2f16da9c | 12 | /* |
madcowswe | 0:0bbf2f16da9c | 13 | //Init motor pwm |
madcowswe | 0:0bbf2f16da9c | 14 | left.period_ms(20); |
madcowswe | 0:0bbf2f16da9c | 15 | left = 0.01; |
madcowswe | 0:0bbf2f16da9c | 16 | right.period_ms(20); |
madcowswe | 0:0bbf2f16da9c | 17 | right = 0.01; |
madcowswe | 0:0bbf2f16da9c | 18 | |
madcowswe | 0:0bbf2f16da9c | 19 | front.period_ms(20); |
madcowswe | 0:0bbf2f16da9c | 20 | front = 0.01; |
madcowswe | 0:0bbf2f16da9c | 21 | rear.period_ms(20); |
madcowswe | 0:0bbf2f16da9c | 22 | rear = 0.01; |
madcowswe | 0:0bbf2f16da9c | 23 | */ |
madcowswe | 0:0bbf2f16da9c | 24 | |
madcowswe | 0:0bbf2f16da9c | 25 | pc.printf("Motors initialized\r\n"); |
madcowswe | 0:0bbf2f16da9c | 26 | |
madcowswe | 0:0bbf2f16da9c | 27 | //Setup accelerometer |
madcowswe | 0:0bbf2f16da9c | 28 | setupaccel(); |
madcowswe | 0:0bbf2f16da9c | 29 | pc.printf("Accelorometer initialized\r\n"); |
madcowswe | 0:0bbf2f16da9c | 30 | |
madcowswe | 0:0bbf2f16da9c | 31 | //Setup gyros, and calibrate them |
madcowswe | 0:0bbf2f16da9c | 32 | wait(0.5); |
madcowswe | 0:0bbf2f16da9c | 33 | calibgyro(); |
madcowswe | 0:0bbf2f16da9c | 34 | pc.printf("Gyros initialized and calibrated\r\n"); |
madcowswe | 0:0bbf2f16da9c | 35 | |
madcowswe | 0:0bbf2f16da9c | 36 | } |