Skip to content

Commit

Permalink
Renamed SERVO_PIN to ROTOR1_PIN. Added definitions for ROTOR2_PIN and…
Browse files Browse the repository at this point in the history
… ROTOR3_PIN
  • Loading branch information
0xjairo committed Dec 18, 2011
1 parent e3bd839 commit ce8f483
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion esc-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void set_servo_angle(float angle)

duty = SERVO_MIN + (int)(angle * SERVO_ANGLE_TO_DUTY);
if(duty > SERVO_MAX) duty = SERVO_MAX;
pwmWrite(SERVO_PIN, duty);
pwmWrite(ROTOR1_PIN, duty);
}

void cmd_servo_sweep(void) {
Expand Down
9 changes: 6 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ void setup() {
// Setup timer4 for PWM
timer4.setMode(TIMER_CH1, TIMER_PWM);
timer4.setPrescaleFactor(21);
pinMode(SERVO_PIN, PWM);
pinMode(ROTOR1_PIN, PWM);
pinMode(ROTOR2_PIN, PWM);
pinMode(ROTOR3_PIN, PWM);

//ppm decode setup
// initialize usb
SerialUSB.begin();
while(!isConnected()); //wait till console attaches.
SerialUSB.println("Hello!");
SerialUSB.println("Welcome user!");

// ppm decode setup
// init timer1 and dma
init_timer_input_capture_dma();
}
Expand Down
20 changes: 19 additions & 1 deletion main.h
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
#define SERVO_PIN 16
/*
* Rotor definitions on tricopter
* Note that motor 3 is the tail rotor
*
* ( 1 ) ( 2 ) Front
* \ /
* +------+
* |
* |
* ( 3 ) Tail
*
*/

/* Timer 4, Ch 1 */
#define ROTOR1_PIN 16
/* Timer 4, Ch 2 */
#define ROTOR2_PIN 15
/* Timer 4, Ch 3 */
#define ROTOR3_PIN 32

0 comments on commit ce8f483

Please sign in to comment.