Tested in MultiWii 1.8Patch2
You can see here the effect (only one pattern light) http://www.youtube.com/watch?v=JsjTqMQUfg8
I know that is possible to optimize and integrate the code into MultiWii but I have prepared a version with minimums modifications to MultiWii code.
It’s only necessary add the LED.pde file to the directory where you have the multiwii code and do 4 small changes in MultiWii_1_8_patch2.pde file
Change 1 before:
Code: Select all
static float EstVelocity = 0.0f;
static float EstAlt = 0.0f;
//for log
static uint16_t cycleTimeMax = 0; // highest ever cycle timen
static uint16_t cycleTimeMin = 65535; // lowest ever cycle timen
Change 1 after:
Code: Select all
static float EstVelocity = 0.0f;
static float EstAlt = 0.0f;
static uint8_t buzzerFreq; // LED
//for log
static uint16_t cycleTimeMax = 0; // highest ever cycle timen
static uint16_t cycleTimeMin = 65535; // lowest ever cycle timen
Change 2 before:
Code: Select all
static uint8_t buzzerState = 0;
static uint32_t vbatRaw = 0; //used for smoothing voltage reading
static uint8_t buzzerFreq; //delay between buzzer ring
uint8_t axis;
uint8_t prop1,prop2;
Change 2 after:
Code: Select all
static uint8_t buzzerState = 0;
static uint32_t vbatRaw = 0; //used for smoothing voltage reading
// static uint8_t buzzerFreq; //delay between buzzer ring //LED
uint8_t axis;
uint8_t prop1,prop2;
Change 3 before:
Code: Select all
#if defined(POWERMETER)
for(uint8_t i=0;i<=PMOTOR_SUM;i++)
pMeter[i]=0;
#endif
}
// ******** Main Loop *********
void loop () {
Change 3 after:
Code: Select all
#if defined(POWERMETER)
for(uint8_t i=0;i<=PMOTOR_SUM;i++)
pMeter[i]=0;
#endif
sq_led_init(); //LED
}
// ******** Main Loop *********
void loop () {
Change 4 before:
Code: Select all
if (currentTime > (rcTime + 20000) ) { // 50Hz
rcTime = currentTime;
computeRC();
// Failsafe routine - added by MIS
#if defined(FAILSAFE)
Change 4 after:
Code: Select all
if (currentTime > (rcTime + 20000) ) { // 50Hz
rcTime = currentTime;
sq_led_heartbeat(); //LED
computeRC();
// Failsafe routine - added by MIS
#if defined(FAILSAFE)
I will add both files (LED.pde and MultiWii_1_8_patch2.pde)
There are 5 different LED sequences:
• ACRO
• STABLE
• BATTERY ALARM 1
• BATTERY ALARM 2
• BATTERY ALARM 3
Once a battery alarm start can’t be used Acro and stable patterns. You can see some small erratic modes given that the transitions between battery levels have some hysteresis (rapid changes between levels in the limit)
The patterns can be defined in LED.pde file (see comments inside the file)
Connection diagram
You can use any available PIN that it’s not used by MultiWii
In Flyduino you can use A1, A2, A3 (A4, A5 it’s not possible to use see ATMega 1280, 2560 documentation, page 89 (Idont know how disable JTAG) 4, 9, 10, 11.
In Mega or Seeduino Mega you can use lots of PINs.
You can connect directly a LED (limit the current to 15mA) or use a ULN2803A to draw more Amp.
Pin usage definition in LED.pde.
Let me know if you need any help please