refactor xbee complet
Fork of Repo_Noeud_Mobile by
Embed:
(wiki syntax)
Show/hide line numbers
CountDown.cpp
00001 #include "CountDown.h" 00002 CountDown::CountDown(int time) 00003 // initialisation list 00004 : t(time>>2) /// division par 4 pour temps entre ch. LED. 00005 { 00006 //pc.printf("constructor time %i \r\n", t); 00007 led[0] = new DigitalOut(LED1); 00008 led[1] = new DigitalOut(LED2); 00009 led[2] = new DigitalOut(LED3); 00010 led[3] = new DigitalOut(LED4); 00011 00012 } 00013 00014 CountDown::~CountDown() 00015 { 00016 for(int i(0); i<NBRE_LED; i++){ 00017 delete led[i]; 00018 } 00019 } 00020 00021 bool CountDown::run() 00022 { 00023 int j(NBRE_LED); 00024 00025 for(int i(0); i<j ; i++){ // ALL ON. 00026 led[i]->write(1); 00027 } 00028 00029 while(j) // Actual CountDown. 00030 { 00031 j--; 00032 Thread::wait(t); 00033 led[j]->write(0); 00034 } 00035 00036 for(int u(0); u < NBRE_LED; u++) // Flashing State 00037 { 00038 Thread::wait(100); 00039 for(int i(0); i<NBRE_LED ; i++){ 00040 led[i]->write(u%2); 00041 } 00042 } 00043 00044 return true; 00045 }
Generated on Thu Jul 21 2022 13:34:51 by
1.7.2
