how to connect buzzer and turn on LED in ARM nRF51822

Status
Not open for further replies.

Prabhu Durai

Newbie level 6
Joined
Mar 27, 2015
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
133
i am new to this embedded world i dont know how to write c program for turn on LED and how to connect buzzer to nRF51822 controller

my objective ;

press the button for 2 seconds

then LED must be turn on

followed by the buzzer must provide three beep signal

please help me to do this task

as soon as possible
 

Sorry I am not aware about your controller but for program side you need to define the one gpio as INPUT(button) and other two gpio as output one for led and another for buzzer.

Code:
   if(sw_pressed )
{
    //on timer to check sw pressed for 2 sec

  if(time==2sec)
 {
    led_gpio_on;
    buzzer_on;
    delay;
    buzzer_off;
    delay;
  //repeat buzzer code in for loop
 }
}

else
{
   timer-off;
   led_gpio_off;
   buzzer_off;
}
 

Thanks for your response

ARM nRF51822 microcontroller do i need to generate pwm signal for connecting and generating the beep sound in buzzer or i can use your code directly?
 

you can simple turn on and off buzzer with some delay. it will give pulses that result in tones
 

I mean I don't use ARM controller and don't aware about its compiler and programming gpios.You can use the code as I suggested but just repeat the buzzer on and off number of times you want to beep the buzzer.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…