Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (27 sloc) 698 Bytes
#ifndef _BEEP_TASK_
#define _BEEP_TASK_
#include "NXCDefs.h"
task beep_if_red()
{
#define RED 7
#define RED_BIAS 3
#define COLOR_DELAY 100
#define MAGIC_DELAY 2000
int color=0;
int r=0, g=0, b=0;
int count = 0;
while(true){
ReadSensorHTColor(IN_4, color, r, g, b);
if( abs(color - RED) < RED_BIAS ){
if (count < 3){
do_beep_red_line();
Wait(MAGIC_DELAY);
}else{
do_beep_finish();
}
count +=1;
}
Wait(COLOR_DELAY);
}
}
#endif
Something went wrong with that request. Please try again.