Arduino_Blink example with Alarm trigger instead of loop

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
TUUN
Newbie
Posts: 4
Joined: Thu Mar 05, 2015 7:54 am

Arduino_Blink example with Alarm trigger instead of loop

Post by TUUN » Fri Mar 06, 2015 11:37 am

Hello,

As I mentioned in the title I want to reconfigure the example of Arduino_uno Blink so that the Task ( Toggle Led) could be Activated periodic with an Alarm condition instead of using the loop.

Please someone may explain ?

I add the Counter and the Alarm ( TaskL1 activation) in the Oil File and I configure the SetRelAlarm in the code.cpp. ( when I load the new arduino.hex nothing happen : the Alarm is never activated I guess)

I think I have a problem with the Counter configuration in the code.cpp :
how can I declare the Counter properly in the task.c or code.cpp ?
I am newly with Arduino_uno.

the example Arduinoun blink example in the virtual machine proposed by Erika.

Thank you,

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Arduino_Blink example with Alarm trigger instead of loop

Post by paolo.gai » Fri Mar 06, 2015 12:15 pm

Hi,

try to look at the "Event" template in

pic30/FLEX Demo Board/OO examples / Event Demo

it includes Alarms...

My suggestion is to program a timer, and attach the IncrementCounter call into the timer handler...

Ciao,

PJ

TUUN
Newbie
Posts: 4
Joined: Thu Mar 05, 2015 7:54 am

Re: Arduino_Blink example with Alarm trigger instead of loop

Post by TUUN » Fri Mar 06, 2015 11:11 pm

paolo.gai wrote:Hi,

try to look at the "Event" template in

pic30/FLEX Demo Board/OO examples / Event Demo

it includes Alarms...

My suggestion is to program a timer, and attach the IncrementCounter call into the timer handler...

Ciao,

PJ
Thank you for your answer,

I have already tried it and I have also tried the alarm counter example in project GPIO stm32f4.

I think the problem is : wrong timer configuration in the arduinouno and/or wrong initialization of the myCounter (defined as the Counter in the oil file).

A normal timer example ( tested in the arduino IDE) should work also properly in the project within eclipe RT DRUID for the arduino uno ? or should be there some reconfiguration of libraries when I build the project ?

Thank you,

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Arduino_Blink example with Alarm trigger instead of loop

Post by paolo.gai » Sat Mar 07, 2015 9:23 am

You are right in the sense there is not a demo for Arduino using the timer to create a simple periodic task.

I sent you by e-mail a set of files which should help in the task. They are taken from the code generated for ERIKA by E4Coder (http://www.e4coder.com). I removed all the parts which were not useful for the timer, and left the basic skeleton.

If you want it would be nice if at the end of this thread you'll send back a working example to be included in the ERIKA repository...

PJ

TUUN
Newbie
Posts: 4
Joined: Thu Mar 05, 2015 7:54 am

Re: Arduino_Blink example with Alarm trigger instead of loop

Post by TUUN » Wed Mar 11, 2015 8:20 am

paolo.gai wrote:You are right in the sense there is not a demo for Arduino using the timer to create a simple periodic task.

I sent you by e-mail a set of files which should help in the task. They are taken from the code generated for ERIKA by E4Coder (http://www.e4coder.com). I removed all the parts which were not useful for the timer, and left the basic skeleton.

If you want it would be nice if at the end of this thread you'll send back a working example to be included in the ERIKA repository...

PJ
Thank you for your answer and your e-mail.

I have decided to use only STM32F4 instead of different Microcontroller in my final project.

Probably I will try after finishing my project to use different Microctonroller.

Thank you,

Post Reply