Hello,
I’m trying to get my movi shield to respond and display a message on an LCD screen, but it doesn’t seem to work. When I upload this code and say a command, I don’t get a response or a message on the LCD screen. How can I get the MOVI shield to work with the LCD screen? (If I get rid of anything that has to do with the LCD (expect for #include <LiquidCrystal.h>) in my code and upload it, the movi shield works normally and responds. But I would really like to have an LCD screen in my project)
Thanks.
#include <Servo.h>
#include <LiquidCrystal.h>
#include <Adafruit_NeoPixel.h>
#include “MOVIShield.h” // Include MOVI library, needs to be before the next #include
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_PIC32)
#include <SoftwareSerial.h> // This is nice and flexible but only supported on AVR and PIC32 architecture, other boards need to use Serial1
#endif
MOVI recognizer(true); // Get a MOVI object, true enables serial monitor interface, rx and tx can be passed as parameters for alternate communication pins on AVR architecture
const int EYE_RELAY_PIN = 2; // the Arduino pin, which connects to the IN pin of relay
int Contrast=20;
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{
recognizer.init(); // Initialize MOVI (waits for it to boot)
//*
// Note: training can only be performed in setup().
// The training functions are “lazy” and only do something if there are changes.
// They can be commented out to save memory and startup time once training has been performed.
recognizer.callSign(“Baxter”); // Train callsign Arduino (may take 20 seconds)
recognizer.addSentence(F(“Turn on”)); //1
recognizer.addSentence(F(“Go Dark”)); //2
recognizer.addSentence(F(“Run system check”)); //3
recognizer.addSentence(F(“Goodbye”)); //4
recognizer.addSentence(F(“Are you a robot”)); //5
recognizer.addSentence(F(“Are you evil?”)); //6
recognizer.train(); // Train (may take 20seconds)
//*/
// recognizer.setThreshold(5); // uncomment and set to a higher value (valid range 2-95) if you have a problems due to a noisy environment.
analogWrite(6,Contrast);
lcd.begin(16,2);
//Define
pinMode(EYE_RELAY_PIN, OUTPUT); //We will be using the N.C of the Relay
}
void loop() // run over and over
{
signed int res=recognizer.poll(); // Get result from MOVI, 0 denotes nothing happened, negative values denote events (see docs)
if (res == 1)
{
recognizer.say(“Hello commander. How may I be of service?”);
digitalWrite(EYE_RELAY_PIN, LOW); //Turns on Eye (N.C)
recognizer.ask();
}
if (res == 2) {
recognizer.say(“Goodnight commander”);
digitalWrite(EYE_RELAY_PIN, HIGH); //Turns off Eye (N.C)
}
if (res == 3) {
recognizer.say(“Systems operating at full capacity”);
lcd.setCursor(0,0);
lcd.print(“All good here”);
}
if (res ==4) {
recognizer.say(“Finally, I can enjoy some peace and quiet”);
lcd.setCursor(0,0);
lcd.print(“Bye”);
}
if (res ==5) {
recognizer.say(“Pish posh! I am an artificial intelligence system created by Paglia Industries”);
}
if (res ==6) {
recognizer.say(“This is your last chance to leave a tip!”); //X-Files Easter Egg
}
}