Hey All,
I am having right issues getting a vertical scrolling LCD working.
The code below checks a 18 core cable for continuity, then reports back on the LCD with each cores results and whether the cable passed or not.
I am struggling with how to print to the lcd the pin numbers (lcdPrint(o)
I do get the error:
soca_tester:85: error: converting to ‘String’ from initializer list would use explicit constructor ‘String::String(unsigned char, unsigned char)’
lcdPrint(o);
But i cannot find anything online that makes sense to me
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
String Line1;
String Line2;
uint8_t outPins[] = {47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30};Â Â Â Â Â Â // Output pins
uint8_t inpPins[] = {29, 28, 27, 26, 25, 24, 23, 22, 51, 50, 19, 18, 17, 16, 15, 14, 48, 49};Â Â Â Â // Input pins
// LCD SCROLLING SETUP //
void lcdPrint(String lcdText) {
  lcd.clear();
  Line1 = Line2;
  lcd.setCursor(0, 0);
  lcd.print(Line1);
  Line2 = lcdText;
  Line2.replace("\r\n", "");
  lcd.setCursor(0, 1);
  lcd.print(Line2);
  Line1 = "";
  lcdText = "";
}
// LCD SCROLLING SETUP //
void setup(){
 Serial.begin(115200);
Â
 lcd.begin();           // initialize the lcd
 // Print a message to the LCD.
 lcd.backlight();
 lcd.setCursor(1,0);
 lcd.print("Socapex Tester");
 delay(3000);
Â
Â
 for (uint8_t i = 0; i < sizeof(outPins); i++){ // Setup output pins
  pinMode(outPins[i],OUTPUT);
  digitalWrite(i,LOW);
 }
 for (uint8_t i = 0; i < sizeof(inpPins); i++){ // Setup input pins
  pinMode(inpPins[i],INPUT);          // Turn off internap pullup resistor
 }
 Serial.println("Begin...");
 if (testCable() == true)
 {
 lcdPrint("** Passed **");
 Serial.println("** Passed **");
 }
 else
 {
 Serial.println("** Failed **");
 lcdPrint("** Failed **");
 //lcd.clear();
 //lcd.setCursor(1,0);
 //lcd.print("Failed");
 }
}
void loop(){
}
bool testCable(){
 bool testResult = true;            // Assume cable is good
 uint8_t count = 0;               // Count of correct connections
Â
 if (sizeof(outPins) != sizeof(inpPins)) {   // Array sizes match?
  Serial.println(F("ERROR: Array Sizes Do Not Match."));
  return false;                // Exit now
 }
Â
 for (uint8_t o = 0; o < sizeof(outPins); o++){ // Loop though output pins
  Serial.print("Pin \t");
  Serial.print(o);
  //Serial.print("[");
  //Serial.print(outPins[o]);
  //Serial.print("]\t");
 Â
  digitalWrite(outPins[o],HIGH);        // Set pin high
  if (digitalRead(inpPins[o]) == HIGH){    // Is correct pin connected?
   count++;                  // Increment count
   Serial.print("->");             // Display it as first pin
   Serial.print(o);              // Display it as first pin
   //Serial.print("[");
   //Serial.print(inpPins[o]);
   //Serial.print("]");
  Â
   lcdPrint(o);
  Â
   delay(500);
  Â
  }
 Â
  for (uint8_t i = 0; i < sizeof(inpPins); i++){// Scan input pins
   if (digitalRead(inpPins[i]) == HIGH){   // If pin is high must be connected to output
    if (o != i){               // If array numbers don't match then must be error
     Serial.print(" X ");
     Serial.print(i);
     //Serial.print("[");
     //Serial.print(inpPins[i]);
     //Serial.print("]");
     testResult = false;          // Bad wire
    }
   }
  }
  digitalWrite(outPins[o],LOW);        // Set output back to low
  Serial.println();              // New line ready for next pin
 }
Â
 if (count != sizeof(outPins)){         // Have we had the correct number of correct pins?
  testResult = false;             // If not then must be error
 }
 return testResult;
}