renk sensoru kullanimi(TCS3200)

Dependencies:   mbed TCS3200

Committer:
marvas
Date:
Sat Jan 05 06:58:03 2019 +0000
Revision:
0:9f82bd528461
renk sensoru kullanimi

Who changed what in which revision?

UserRevisionLine numberNew contents of line
marvas 0:9f82bd528461 1 #include "mbed.h"
marvas 0:9f82bd528461 2 #include "TCS3200.h"
marvas 0:9f82bd528461 3
marvas 0:9f82bd528461 4 TCS3200 color(A0, A1, A2, A3, A4); //Create a TCS3200 object
marvas 0:9f82bd528461 5 // S0 S1 S2 S3 OUT
marvas 0:9f82bd528461 6
marvas 0:9f82bd528461 7 int main() {
marvas 0:9f82bd528461 8 long red, green, blue, clear;
marvas 0:9f82bd528461 9
marvas 0:9f82bd528461 10 //Set the scaling factor to 100%
marvas 0:9f82bd528461 11 color.SetMode(TCS3200::SCALE_100);
marvas 0:9f82bd528461 12
marvas 0:9f82bd528461 13 while(1){
marvas 0:9f82bd528461 14 //Read the HIGH pulse width in nS for each color.
marvas 0:9f82bd528461 15 //The lower the value, the more of that color is detected
marvas 0:9f82bd528461 16 red = color.ReadRed();
marvas 0:9f82bd528461 17 green = color.ReadGreen();
marvas 0:9f82bd528461 18 blue = color.ReadBlue();
marvas 0:9f82bd528461 19 clear = color.ReadClear();
marvas 0:9f82bd528461 20
marvas 0:9f82bd528461 21 printf("RED: %10d GREEN: %10d BLUE: %10d CLEAR: %10d \n ", red, green, blue, clear);
marvas 0:9f82bd528461 22
marvas 0:9f82bd528461 23 wait(0.1);
marvas 0:9f82bd528461 24 }
marvas 0:9f82bd528461 25 }