I got this error this morning after adding a sub to my code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
char inChar; // Where to store the character read
byte index = 0; // Index into array; where to store the character
char *AXpos;
char *EYpos;
const char *delimiter = ",";
const byte numChars = 15;
const long _maxRotorAX = 18000L; // maximum rotor azimuth in degrees * 100
const long _maxRotorEY = 18000L; // maximum rotor elevation in degrees * 100
char inData[numChars]; // an array to store the received data
boolean newData = false;
void setup() {
LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 16 chars and 2 line display
Serial.begin(9600);
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("XtTrm Ready for data");
lcd.setCursor(2, 1);
lcd.print(" XY-Antenna");
lcd.setCursor(0, 2);
lcd.print("Arduino LCM IIC 2004");
lcd.setCursor(1, 3);
lcd.print("(c)Harry H. Arends");
Serial.println("XtTrm Ready");
}
void loop() {
recvWithEndMarker();
processNewData();
extractData();
updateDisplay();
}
void recvWithEndMarker() {
static byte ndx = 0;
char endMarker = '\n';
char rc;
while (Serial.available() > 0 && newData == false) {
rc = Serial.read();
if (rc != endMarker) {
inData[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
//Serial.print(ndx);
//Serial.print("-");
//Serial.print("Received= ");
//Serial.println(inData);
} else {
//Serial.println("Done");
inData[ndx] = '\0'; // terminate the string
ndx = 0;
newData = true;
}
//Serial.println(ndx);
}
}
void processNewData() {
if (newData == true) {
//Serial.println();//terminate starsline
//Serial.print("This came just in ... ");
//Serial.println(inData);
// newData = false;
} else {
//Serial.print("*");//max.14 stars
}
}
void extractData() {
//Extract two numbers from received data
if (newData == true) {
AXpos = strtok(inData, delimiter);
EYpos = strtok(NULL, delimiter);
Serial.print("AX= ");
Serial.println(AXpos);
Serial.print("EY= ");
Serial.println(EYpos);
newData = false;
inData[0] = '\0'; // clear the string
}
}
void updateDisplay() {
// Clear used rows
lcd.setCursor(0, 2);
// 12345678901234567890
lcd.print(" ");
lcd.setCursor(0, 3);
lcd.print(" ");
}
at the bottom I added a routine to populate my 2004LCD,
If I comment out the lcd lines I wont get a error, so what did I mis??