SCARAB AVATAR multiwii code.

SCARAB AVATAR multiwii code.

Postby tryss » Fri Mar 01, 2013 3:11 pm

Hi all,

Someone could tell me the modification to be done for that configuration ?
How to add a motor to the BI configuration ?
or
How to add two servo to the TRI configuration ?

My board is a méga (AIO PRO V1). thanks by advance.
tryss
 
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Postby PatrikE » Fri Mar 01, 2013 10:40 pm

In def.h increase motors to 3.
Code: Select all
#elif defined(BI)
  #define NUMBER_MOTOR     2
  #define PRI_SERVO_FROM   5 // use servo from 5 to 6
  #define PRI_SERVO_TO     6


In otput.ino
Add motor[2] = PIDMIX(0, 1, 0); //Extra
Code: Select all
  #ifdef BI
    motor[0] = PIDMIX(+1, 0, 0); //LEFT
    motor[1] = PIDMIX(-1, 0, 0); //RIGHT       
    servo[4]  = constrain(1500 + (YAW_DIRECTION * axisPID[YAW]) + axisPID[PITCH], 1020, 2000); //LEFT
    servo[5]  = constrain(1500 + (YAW_DIRECTION * axisPID[YAW]) - axisPID[PITCH], 1020, 2000); //RIGHT
  #endif
PatrikE
 
Posts: 1921
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden

Re: SCARAB AVATAR multiwii code.

Postby tryss » Sat Mar 02, 2013 9:25 am

PatrikE i ´ve finally understand That scarab avatar is using the TRI configuration.
So i define SERVO_6_PINMODE pinMode(7,OUTPUT); // to command m'y second servo
And i add for the high PORTE |= 1<<5; and PORTE &= ~(1<<5); for low

Problem output 7 doesn t work with the servo ???? Why ????,
tryss
 
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Postby tryss » Sat Mar 02, 2013 11:21 am

Its work Now ! I understand Now That digital pin 7 of the board is PH4 :)
Everything is based on arduino board !!!!! Digital pin 2 is PE4 !!!!!! Yeah im pround !!!!
tryss
 
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Postby PatrikE » Sat Mar 02, 2013 6:21 pm

It seems like it's a TRIcopter with 2 yaw servos on the front arms.
Easiest would be to just use a Y-servocable.

Mega and 328 based boards use different pins for servos.
Image
PatrikE
 
Posts: 1921
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden

Re: SCARAB AVATAR multiwii code.

Postby tryss » Sun Mar 03, 2013 10:42 am

Yes its easy but you need to found a Y cable :)

you can write it like that too :

#define SERVO_6_PINMODE pinMode(2,OUTPUT);pinMode(7,OUTPUT);
#define SERVO_6_PIN_HIGH PORTE |= 1<<4;PORTH |= 1<<4;
#define SERVO_6_PIN_LOW PORTE &= ~(1<<4);PORTH &= ~(1<<4);

but you need to know the corresponding between Digital pin and Atmega 2560 PORT

digital PIN 1 is PE1
digital PIN 2 is PE4
digital PIN 3 is PE5
digital PIN 4 is PG5
digital PIN 5 is PE3
digital PIN 6 is PH3

and so and.... it's the PinMap2560 that i've found on arduino web page.
tryss
 
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Postby PatrikE » Sun Mar 03, 2013 5:14 pm

Or do like other people do...
Code: Select all
#elif defined(TRI)
  #define NUMBER_MOTOR     3
  #define PRI_SERVO_FROM   6 // use only servo 6
  #define PRI_SERVO_TO     6

Change to the servos you want to use.

Then the code in the project Fix all the rest...


/Patrik
PatrikE
 
Posts: 1921
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden

Re: SCARAB AVATAR multiwii code.

Postby tryss » Sun Mar 03, 2013 10:28 pm

Yes right ! But you Still need to change SERVO_7_PINMODE who is affected to pin 5 (already reserved for front right motor).
Even SERVO_8_PINMODE who is pin 3 (rear motor already affected).
tryss
 
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Postby tryss » Sun Mar 03, 2013 10:36 pm

the video of the first flight : i still need to tune the PID but it's fly well.

http://www.facebook.com/photo.php?v=102 ... 8537054837
tryss
 
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Postby koliver » Sat Jun 17, 2017 10:18 am

Mega and 328 based boards use different pins for servos.
Image[/quote]

My question is that:the specified PIN can be configured as the motor and Servo at the same time ?

Thanks.
koliver
 
Posts: 1
Joined: Sat Jun 10, 2017 10:20 am


Return to General discussions

Who is online

Users browsing this forum: No registered users and 1 guest