Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- #include <math.h>
- int motor_pin[4] = {
- 3, 5, 6, 9};
- Servo motor[4];
- int throttle[4] = {
- 20, 20 ,20 ,20};
- void sendSignalToMotor() {
- int c;
- for(c=0; c<4; c++) {
- int fix = (int)tFix[c];
- motor[c].write(throttle[c] + fix);
- }
- }
- void setup()
- {
- int c;
- Serial.begin(9600);
- delay(10);
- Serial.println("initialize!");
- for(c=0; c<4; c++){
- throttle[c] = 15;
- motor[c].attach(motor_pin[c]);
- }
- // 5 sec low throttle for setup
- int d;
- for(d=0; d<500; d++){
- sendSignalToMotor();
- delay(10);
- }
- for(c=0; c<4; c++){
- throttle[c] = 50;
- }
- }
- void loop()
- {
- sendSignalToMotor();
- delay(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement