Wiblocks --- LED_debug

LED_debug/LED_debug.cpp

00001 #include "LED_debug.h"
00002 
00003 extern "C" {
00004   #include <inttypes.h>
00005   #include "WConstants.h"
00006 }
00007 
00008 
00017 
00018 LED_debug::LED_debug(unsigned char pin) {
00019   _pin = pin;
00020   digitalWrite(_pin, 0);
00021   pinMode(_pin, OUTPUT);
00022 };
00023 
00024 
00033 void LED_debug::blink(unsigned char num_times) {
00034   unsigned char count = 0;
00035   while(1) {
00036     digitalWrite(_pin, 1);
00037     delay(_on_delay);
00038     digitalWrite(_pin, 0);
00039     delay(_off_delay);
00040     if (num_times == 0) continue;
00041     if (++count == num_times) break;
00042   }
00043 };
00044