paiprashanth / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

piezo buzzer not working #722

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. connect a piezo buzzer to AN5 on APM1
2. power on

What is the expected output? What do you see instead?
The piezo buzzer should give a beep, but it doesn't.

What version of the product are you using? On what operating system?
ArduCopter-2.7.2 on APM1

Please provide any additional information below.
I think the reason is that PIEZO_PIN isn't set to output mode. The following 
fix works for me:

$ git diff system.pde
diff --git a/ArduCopter/system.pde b/ArduCopter/system.pde
index 68657e4..8700da6 100644
--- a/ArduCopter/system.pde
+++ b/ArduCopter/system.pde
@@ -142,10 +142,15 @@ static void init_ardupilot()
        pinMode(COPTER_LED_6, OUTPUT);          //Motor or Aux LED
        pinMode(COPTER_LED_7, OUTPUT);          //Motor or GPS LED
        pinMode(COPTER_LED_8, OUTPUT);          //Motor or GPS LED
-
-       if ( !bitRead(g.copter_leds_mode, 3) ){
+       pinMode(PIEZO_PIN, OUTPUT);                     //Buzzer
+       #if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2
+               if ( !bitRead(g.copter_leds_mode, 3) )
+               {
+                       piezo_beep();
+               }
+       #else
                piezo_beep();
-       }
+       #endif

 #endif

Original issue reported on code.google.com by fsiebe...@gmail.com on 22 Aug 2012 at 6:23