Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 1:334b40b47233
- Parent:
- 0:fa6bdbdd4239
- Child:
- 2:d168f964c331
--- a/main.cpp Thu Feb 28 22:05:21 2019 +0000
+++ b/main.cpp Thu Feb 28 22:33:57 2019 +0000
@@ -48,12 +48,13 @@
******************************************************************************/
#define INITELE 0xFE
-#define CMD 0xF1
+#define CMD 0x01
Serial command(USBTX, USBRX);
-scolor_TCS3200 scolor(PB_4, PB_5, PB_6, PB_7, PB_8);
+// S0, S1, S2, S3, OUT
+scolor_TCS3200 scolor(PA_8, PB_10, PB_4, PB_5, PB_3);
// definición de las funciones
void setup_uart();
@@ -68,7 +69,7 @@
while(1){
leer_datos();
if (cmd==CMD){}
- //leer_color();
+ leer_color();
}
}
@@ -82,18 +83,21 @@
void leer_datos(){
while(command.getc()!= INITELE);
cmd=command.getc();
+
}
void leer_color(){
+
+
long red = scolor.ReadRed();
long green = scolor.ReadGreen();
long blue = scolor.ReadBlue();
long clear = scolor.ReadClear();
- printf("RED: %10d GREEN: %10d BLUE: %10d CLEAR: %10d ", red, green, blue, clear);
+ printf("RED: %5d GREEN: %5d BLUE: %5d CLEAR: %5d \n ", red, green, blue, clear);
}