void red_read(void) // function to select red filter and display the count generated by the sensor on LCD. The count will be more if the color is red. The count will be very less if its blue or green. { //Red filter_red(); //select red filter pulse=0; //reset the count to 0 _delay_ms(100); //capture the pulses for 100 ms or 0.1 second red = pulse; //store the count in variable called red _delay_ms(1000); // Display for 1000ms or 1 second }
void red_read(void) // function to select red filter and display the count generated by the sensor on LCD. The count will be more if the color is red. The count will be very less if its blue or green. { //Red filter_red(); //select red filter pulse=0; //reset the count to 0 _delay_ms(100); //capture the pulses for 100 ms or 0.1 second red = pulse; //store the count in variable called red lcd_cursor(1,1); //set the cursor on row 1, column 1 lcd_string("Red Pulses"); // Display "Red Pulses" on LCD lcd_print(2,1,red,5); //Print the count on second row _delay_ms(1000); // Display for 1000ms or 1 second lcd_wr_command(0x01); //Clear the LCD }
void color(void) // function to select red filter and display the count generated by the sensor on LCD. The count will be more if the color is red. The count will be very less if its blue or green. { color_sensor_scaling(); //Red filter_red(); //select red filter pulse=0; //reset the count to 0 _delay_ms(100); //capture the pulses for 100 ms or 0.1 second red = pulse; //store the count in variable called red //Green filter_green(); //select green filter pulse=0; //reset the count to 0 _delay_ms(100); //capture the pulses for 100 ms or 0.1 second green = pulse; //store the count in variable called green //Blue filter_blue(); //select blue filter pulse=0; //reset the count to 0 _delay_ms(100); //capture the pulses for 100 ms or 0.1 second blue = pulse; //store the count in variable called blue /*lcd_print(1,1,red,5); lcd_print(1,7,blue,5); lcd_print(1,13,green,5); */if(red<threshold && green <threshold && blue <threshold) //black color detected { data='T'; } else if(red>blue &&red >green) //red color detected { data='R'; } else //green color detected { data='G'; } }