#Blog10_A
Hello Everyone!
It's great to be chosen for the Design for a Cause' Design Challenge, I am thankful to #Element14 Community, #Arduino, and the sponsors.
Here is the Final Project demo!
I am very much thank full to prasannag1993 (Prasanna Kumar)vinyasa.mv , genebren Gene Breniman Sir, gkbhat95 , dixonselvan and all my friends for their encouragement and support.
The Code :
// Headers for Audio Circuit #include <SD.h> #include <SPI.h> #include <AudioZero.h> // Headers for Display #include <Wire.h> #include <ACROBOTIC_SSD1306.h> // Defining the Sentence to be told String T3 ="Can you Switch on the fan"; String T4 ="Its Difficult but possible"; String T5=" Hi I am prashanth Kumar g n, the participant for the ELEMENT14 design contest "; String T6 ="Its Boring Lets play some games"; String T7 ="I want some food"; String T8 ="Shall we have dinner"; String T9 ="I want to go to rest room"; String T10 ="All the best"; String T11 ="Yes I won the Game"; String T12 ="Lets Be Friends"; String T13 ="If you sweat more in Peace, You bleed less in war"; String T14 ="Work hard in Silence, Let your success makes noice"; int a,b,c,d,e; int d1 = 1000; int d2 = 4000; int d3 = 4000; void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); if (!SD.begin(4)) { Serial.println(" failed!"); while(true); } Serial.println(" done."); // 44100kHz stereo => 88200 sample rate AudioZero.begin(32000); Wire.begin(); oled.init(); oled.clearDisplay(); } // the loop routine runs over and over again forever: void loop() { //***************************************************************************** //read the Data from flex sensors int s0 = analogRead(A1); int s1 = analogRead(A2); int s2 = analogRead(A3); int s3 = analogRead(A4); int s4 = analogRead(A2); //***************************************************************************** // print out the value you read: // Serial.print(" s0: "); // Serial.print(s0); // // Serial.print(", s1: "); // Serial.print(s1); // // Serial.print(", s2: "); // Serial.print(s2); // // Serial.print(", s3: "); // Serial.print(s3); // // Serial.print(", s4: "); // Serial.println(s4); //***************************************************************************** // Digitalising the Bend values // Getting a {if(s0<=530) { a=1; Serial.print(" *a: "); Serial.print(a); } else { a=0; Serial.print(" *a: "); Serial.print(a); } // Getting b if(s1<=512) { b=1; Serial.print(" *b: "); Serial.print(b); } else { b=0; Serial.print(" *b: "); Serial.print(b); } // Getting c if(s2<=481) { c=1; Serial.print(" *c: "); Serial.print(c); } else { c=0; Serial.print(" *c: "); Serial.print(c); } // Getting d if(s3<=484) { d=1; Serial.print(" *d: "); Serial.print(d); } else { d=0; Serial.print(" *d: "); Serial.print(d); } // Getting e if(s4<=440) { e=1; Serial.print(" *e: "); Serial.println(e); } else { e=0; Serial.print(" *e: "); Serial.println(e); } delay(d1); } //*************************************************************************** //Sending Text on Appropriate hand sign int z =(a*16)+(b*8)+(c*4)+(d*2)+(e*1); Serial.println(z); switch (z) { case 4: Serial.println(T3); test_t3(); delay(d2); z=0; delay(d3); break; case 2: Serial.println(T4); test_t4(); delay(d2); z=0; delay(d3); break; case 1: Serial.println(T5); test_t5(); delay(d2); z=0; delay(d3); break; case 24: Serial.println(T6); test_t6(); delay(d2); z=0; delay(d3); break; case 20: Serial.println(T7); test_t7(); delay(d2); z=0; delay(d3); break; case 18: Serial.println(T8); test_t8(); delay(d2); z=0; delay(d3); break; case 17: Serial.println(T9); test_t9(); delay(d2); z=0; delay(d3); break; case 28: Serial.println(T10); test_t10(); delay(d2); z=0; delay(d3); break; case 30: Serial.println(T11); test_t11(); delay(d2); z=0; delay(d3); break; case 6: Serial.println(T12); test_t12(); delay(d2); z=0; delay(d3); break; case 7: Serial.println(T13); test_t13(); delay(d2); z=0; delay(d3); break; case 15: Serial.println(T14); test_t14(); delay(d2); z=0; delay(d3); break; default: Serial.println("******"); break; } delay(1200); // delay in between reads for stability } void test_t3() { //Display Text oled.setTextXY(0,0); oled.putString(T3); //Play correspodning voice File myFile2 = SD.open("test3.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t4() { //Display Text oled.setTextXY(0,0); oled.putString(T4); //Play correspodning voice File myFile2 = SD.open("test4.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t5() { //Display Text oled.setTextXY(0,0); oled.putString(T5); //Play correspodning voice File myFile2 = SD.open("test5.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t6() { //Display Text oled.setTextXY(0,0); oled.putString(T6); //Play correspodning voice File myFile2 = SD.open("test6.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t7() { //Display Text oled.setTextXY(0,0); oled.putString(T7); //Play correspodning voice File myFile2 = SD.open("test7.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t8() { //Display Text oled.setTextXY(0,0); oled.putString(T8); //Play correspodning voice File myFile2 = SD.open("test8.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t9() { //Display Text oled.setTextXY(0,0); oled.putString(T9); //Play correspodning voice File myFile2 = SD.open("test9.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t10() { //Display Text oled.setTextXY(0,0); oled.putString(T10); //Play correspodning voice File myFile2 = SD.open("test10.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t11() { //Display Text oled.setTextXY(0,0); oled.putString(T11); //Play correspodning voice File myFile2 = SD.open("test11.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t12() { //Display Text oled.setTextXY(0,0); oled.putString(T12); //Play correspodning voice File myFile2 = SD.open("test12.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t13() { //Display Text oled.setTextXY(0,0); oled.putString(T13); //Play correspodning voice File myFile2 = SD.open("test13.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); } void test_t14() { //Display Text oled.setTextXY(0,0); oled.putString(T13); //Play correspodning voice File myFile2 = SD.open("test14.wav"); if (!myFile2) { while (true); } AudioZero.play(myFile2); }
Thanks for the opportunity.
Top Comments