YX ZHANG
/
Ex_TCS3200
TCS3200 color sensor
Fork of my_example_TCS3200 by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 /*----------------------------------------------------- 00002 File Name : main.cpp 00003 Purpose : For tcs3200 sensor 00004 Creation Date : 24-06-2017 00005 Last Modified : 00006 Created By : Jeasine Ma [jeasinema[at]gmail[dot]com] 00007 -----------------------------------------------------*/ 00008 #include <cstdio> 00009 #include <cstring> 00010 #include <cstdarg> 00011 00012 #include "mbed.h" 00013 #include "TextLCD.h" 00014 #include "color.h" 00015 00016 int main() { 00017 TextLCD lcd(PC_13, PC_14, PC_15, PA_0, PA_1, PB_4, TextLCD::LCD20x4); // rs, e, d4-d7, model 00018 00019 // S0,S1,S2,S3,OUT 00020 ColorSensor color(PB_11, PA_12, PB_1, PB_10, PB_9); //用5个GPIO管脚 00021 00022 while(1) { 00023 int red = color.getRed(); 00024 int green = color.getGreen(); 00025 int blue = color.getBlue(); 00026 lcd.cls(); 00027 lcd.printf("Color:\nR:%d G:%d B:%d", red, green, blue); 00028 wait(1); 00029 } 00030 }
Generated on Wed Jul 13 2022 10:44:21 by 1.7.2