Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * LED Blinking Example
- *
- * Blinks LED on SmartRF04EB board with CC1110EM eval module.
- *
- * Author: David Eisner
- */
- #include "hal_main.h"
- #include "hal_mcu.h"
- /**
- * Blink the LED nBlinks times
- */
- static void appLedBlink(uint8 nBlinks)
- {
- uint8 i;
- i = 0;
- while (TRUE) {
- if (i >= nBlinks)
- return;
- LED1 = LED_ON;
- halWait( 200 ); // ms
- LED1 = LED_OFF;
- halWait( 200 ); // ms
- i++;
- }
- }
- #define NCHARS (sizeof(digitChars)/sizeof(char));
- int main( void )
- {
- char digitChars[] = {'2', '3', '5', '7'};
- int di = 0;
- char c;
- uint8 nBlink;
- INIT_LED1();
- while (TRUE) {
- c = digitChars[di];
- if (c >= '0' && c <= '9')
- nBlink = c - '0';
- else
- nBlink = 5;
- appLedBlink(nBlink);
- di = (di + 1) % NCHARS;
- halMcuWaitMs(3000); // wait a few seconds
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement