Hi everyone,
I currently have a program on my Arduino that reads from the serial port and looks for a string and if the string from the serial port matches one of those strings, it executes the code in that block. This code currently works if I have my Arduino plugged in and type in strings into the serial monitor in the Arduino IDE. The problem that I'm trying to solve is that I want to create a C program that will print statements and then I want those statements to be read by the Arduino as if I was typing into the serial monitor. The purpose of this is that I have a separate piece of hardware that can run C programs and it hooks up to the Arduino and I 'm trying to run the program on the separate piece of hardware so that it talks to the Arduino.
#include <LiquidCrystal.h>
String input = "";
char inputbyte = 0;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
delay(3000);
}
void loop()
{
if(Serial.available() > 0){
inputbyte = Serial.read();
if(inputbyte != '\n'){
input += inputbyte;
}
else{
if(input == "start"){
lcd.print("Welcome!");
delay(3000);
lcd.clear();
}
else if(input == "end"){
lcd.print("Goodbye!");
delay(3000);
lcd.clear();
}
else{
lcd.print("Oops!");
delay(3000);
lcd.clear();
}
input = "";
}
}
}
Thanks for all the help!