Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Smart medicine box

Status
Not open for further replies.
So, I am trying to turn the LED and a buzzer connected to specific ports on at a specific time each day.

Like say at 11 am every day for 10 minutes the buzzer and LEd turns on. I am new to Atmel studio programming and the board am using is A3BU Xplained.

So, I just need some help to get started with the coding and maybe some coding examples for the same, as there is a lot more further programming to be done to it.

Lets say, I have attached the LED and buzzer on the pins on Port2.

So, far I have done a bit of coding in Atmel and have came up with this,


#include <asf.h>

static void alarm(uint32_t time)
{
rtc_set_alarm(14);
while(true)
{
gpio_toggle_pin(J2_PIN0);
gpio_toggle_pin(J2_PIN1);

}
}


int main (void)
{
board_init();
pmic_init();
sysclk_init();
sleepmgr_init();
rtc_init();
rtc_set_callback(alarm);
cpu_irq_enable();
}

Still, not sure, about how to use call back function.

If someone can help.
 
Status
Not open for further replies.

Latest threads

Back
Top