MOVI and LCD

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
}
}

It appears you are using the default MOVI configuration which uses pins 10 and 11 for serial communication between Arduino and MOVI.

You have created a pin conflict by also trying to use pin 11 for your LCD.

See page 10 of the MOVI user manual for more info about pin assignments.

Thanks! This was the issue and you helped solve my problem. I re-wired my LCD screen and re-defined the pins it in the code and all works well. Thanks once again.

This is the working code if anyone’s interested:

#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

//MOVI Uses Pins 10 & 11 to Communicate With the Arduino. To rewire MOVI’s communication to different pins, open Jumper 2 and Jumper 3 and connect the right side of MOVI’s TX jumper (Jumper 2)
//and the right side of MOVI’s RX jumper (Jumper 3) to two other connectors on the Arduino headers using jumper wires. The right side is the pin that is closer to the power and USB plugs.
int Contrast=45;
LiquidCrystal lcd(12, 9, 5, 4, 3, 7);

const int EYE_RELAY_PIN = 2; // the Arduino pin, which connects to the IN pin of relay

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.

//Define
pinMode(EYE_RELAY_PIN, OUTPUT); //We will be using the N.C of the Relay
analogWrite(6,Contrast);
lcd.begin(16,2);
}

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”);
}
if (res ==4) {
recognizer.say(“Finally, I can enjoy some peace and quiet”);
}
if (res ==5) {
recognizer.say(“Pish posh! I am an artificial intelligence system created by Paglia Industries”);
lcd.clear();
}
if (res ==6) {
recognizer.say(“This is your last chance to leave a tip!”); //X-Files Easter Egg
lcd.setCursor(0,0);
lcd.print(“Please Leave”);
lcd.setCursor(0,1);
lcd.print(“a Tip”);

}
}