Le but est qu’un haut-parleur annonce une couleur aléatoire, et que l’utilisateur se déplace jusqu’à trouver la couleur correspondante et qu’il valide à l’aide d’un capteur de couleur.

Dependencies:   mbed GroveColourSensor text_to_speak_mbed

Files at this revision

API Documentation at this revision

Comitter:
Beubarrousse
Date:
Sun Dec 23 18:02:26 2018 +0000
Commit message:
Projet C++, communication avec le capteur de couleur fonctionnelle. La communication avec le TTS ne marche pas

Changed in this revision

GroveColourSensor.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
text_to_speak_mbed.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 87facfc6e955 GroveColourSensor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GroveColourSensor.lib	Sun Dec 23 18:02:26 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/components/code/GroveColourSensor/#56d6b711b8c7
diff -r 000000000000 -r 87facfc6e955 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Dec 23 18:02:26 2018 +0000
@@ -0,0 +1,50 @@
+#include "mbed.h"  
+#include <sstream>            
+#include <GroveColourSensor.hpp>
+#include <text_to_speech.h>
+#include <text_to_speech_img.h>
+
+#include <string>
+
+Serial pc(USBTX, USBRX); // tx, rx
+GroveColourSensor colorSensor(I2C_SDA1, I2C_SCL1);
+SPI spi(p11, p12, p13);
+DigitalOut cs(p26);
+
+
+
+int main() {
+    colorSensor.powerUp();
+    // Attente démarrage capteur
+    wait(1);
+    unsigned colour;
+
+    std::string out_string;
+    std::stringstream ss;
+
+    spi.format(8,3);
+    spi.frequency(100000);
+    
+    // Analyse par le capteur du taux de vert, rouge, bleu
+    for (colour = GroveColourSensor::GREEN; colour < GroveColourSensor::NUM_COLORS-1; colour++) {
+         uint16_t colourValue = colorSensor.readColour(colour);
+         ss << colourValue;
+         out_string = ss.str();
+         
+         // Affichage du taux de couleur
+         pc.printf(out_string.c_str());
+         pc.printf("\n");
+     }
+     colorSensor.powerDown();    
+     
+     
+     // Essai communication avec le TextToSpeech
+     //tts_init();
+     //tts_setup();
+     //tts_power_default_config();
+     //tts_audio_default_config();
+     //tts_volume_set( 0 );
+     //tts_default_config();
+     //tts_speak("Hello world");
+    
+}
diff -r 000000000000 -r 87facfc6e955 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Dec 23 18:02:26 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc
\ No newline at end of file
diff -r 000000000000 -r 87facfc6e955 text_to_speak_mbed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/text_to_speak_mbed.lib	Sun Dec 23 18:02:26 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/daveyclk/code/text_to_speak_mbed/#b33a6418e125