Search in Pinguino World !!

Friday, April 23, 2010

HOWTO use the run led !!

The Run led of Pinguino can be used as a normal led. This output is not defined in the list of pins, but you can use it as described below:

#define RUNLED PORTAbits.RA4

void setup()
{
}

void loop()
{
RUNLED=1;
delay(500);
RUNLED=0;
delay(500);
}

Sometimes it could be useful to use it as a general purpose led.

1 comment:

aleale99 said...

thanks
I use the led for "visual" debug with three different speed :

#define HEART_NORMAL 7500
#define HEART_SLOW 1800
#define HEART_FAST 200

I'd like to use the source on 2 similar enviroment.......

void heartbeat (void) // fa lampeggiare il led al ritmo da heartspeed
{
#ifdef ARDUINO
HeartState ^=1;
digitalWrite(heart_ledPin, HeartState);
#endif

#ifdef PINGUINO
PORTAbits.RA4 ^=1;
#endif

} // end of heartbeat

ciao Aleale99