fork(2) download
  1. #define CUSTOM_SETTINGS
  2. #define INCLUDE_VOICE_RECOGNIZER_SHIELD
  3. #define INCLUDE_MUSIC_PLAYER_SHIELD
  4. #define INCLUDE_TERMINAL_SHIELD
  5. /* Include 1Sheeld library. */
  6. #include <OneSheeld.h>
  7. int Rled=13;
  8. int Yled=12;
  9. int Gled=11;
  10.  
  11. /* Voice commands set by the user. */
  12. const char playCommand[] = "play";
  13. const char stopCommand[] = "stop";
  14. const char yellowCommand[] = "yellow";
  15. const char greenCommand[] = "green";
  16. const char redCommand[] = "red";
  17.  
  18. void setup()
  19. {
  20. pinMode(13,OUTPUT);
  21. pinMode(12,OUTPUT);
  22. pinMode(11,OUTPUT);
  23. /* Start Communication. */
  24. OneSheeld.begin();
  25. /* Error Commands handiling. */
  26. VoiceRecognition.setOnError(error);
  27.  
  28. VoiceRecognition.start();
  29. }
  30.  
  31. void loop ()
  32. {
  33. /* Check if new command received. */
  34. if(VoiceRecognition.isNewCommandReceived())
  35. {
  36. /* Compare the play command. */
  37. if(!strcmp(playCommand,VoiceRecognition.getLastCommand()))
  38. {
  39. digitalWrite(13,HIGH);
  40. digitalWrite(12,HIGH);
  41. digitalWrite(11,HIGH);
  42. }
  43. /* Compare the pause command. */
  44. else if (!strcmp(stopCommand,VoiceRecognition.getLastCommand()))
  45. {
  46. digitalWrite(13,LOW);
  47. digitalWrite(12,LOW);
  48. digitalWrite(11,LOW);
  49. }
  50. /* Compare the stop command. */
  51. else if (!strcmp(yellowCommand,VoiceRecognition.getLastCommand()))
  52. {
  53. digitalWrite(13,LOW);
  54. digitalWrite(12,HIGH);
  55. digitalWrite(11,LOW);
  56. }
  57. /* Compare the next command. */
  58. else if (!strcmp(greenCommand,VoiceRecognition.getLastCommand()))
  59. {
  60. digitalWrite(13,LOW);
  61. digitalWrite(11,HIGH);
  62. digitalWrite(12,LOW);
  63.  
  64. }
  65. else if (!strcmp(redCommand,VoiceRecognition.getLastCommand()))
  66. {
  67.  
  68. digitalWrite(12,LOW);
  69. digitalWrite(13,HIGH);
  70. digitalWrite(11,LOW);
  71. }
  72. }
  73. /* тут должна быть та часть кода на ассемблере
  74.   asm volatile(
  75.   */
  76. );
  77. }
  78.  
  79. /* Error checking function. */
  80. void error(byte errorData)
  81. {
  82. /* Switch on error and print it on the terminal. */
  83. switch(errorData)
  84. {
  85. case NETWORK_TIMEOUT_ERROR: Terminal.println("Network timeout");break;
  86. case NETWORK_ERROR: Terminal.println("Network Error");break;
  87. case AUDIO_ERROR: Terminal.println("Audio error");break;
  88. case SERVER_ERROR: Terminal.println("No Server");break;
  89. case SPEECH_TIMEOUT_ERROR: Terminal.println("Speech timeout");break;
  90. case NO_MATCH_ERROR: Terminal.println("No match");break;
  91. case RECOGNIZER_BUSY_ERROR: Terminal.println("Busy");break;
  92. }
  93. }
  94.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:6:23: fatal error: OneSheeld.h: No such file or directory
 #include <OneSheeld.h>
                       ^
compilation terminated.
stdout
Standard output is empty