Hi, I recently bought this diplay:http://international.switch-science.com/catalog/1407/
On that site there is a sketch of the test and it works, but I can not print a variable with the command "lcd_print ();".
I can only print a word, for example: "lcd_print (" Hello! ");"
Can anyone help me? Thanks ![]()
the sketch test is this:
#include <Wire.h>
#define vddPin 16Â Â // ArduinoA2
#define gndPin 17Â Â // ArduinoA3
#define sdaPin 18Â Â // ArduinoA4
#define sclPin 19Â Â // ArduinoA5
#define I2Cadr 0x3e // Fixed
byte contrast = 35; // Contrast (0~63)
boolean contrastFlag = false;
void setup() {
 pinMode(gndPin, OUTPUT);
 digitalWrite(gndPin, LOW);
 pinMode(vddPin, OUTPUT);
 digitalWrite(vddPin, HIGH);
 delay(500);
 Wire.begin();
 lcd_cmd(0b00111000); // function set
 lcd_cmd(0b00111001); // function set
 lcd_cmd(0b00000100); // EntryModeSet
 lcd_cmd(0b00010100); // interval osc
 lcd_cmd(0b01110000 | (contrast & 0xF)); // contrast Low
 lcd_cmd(0b01011100 | ((contrast >> 4) & 0x3)); // contast High/icon/power
 lcd_cmd(0b01101100); // follower control
 delay(200);
 lcd_cmd(0b00111000); // function set
 lcd_cmd(0b00001100); // Display On
 lcd_cmd(0b00000001); // Clear Display
 delay(2);
}
void loop() {
 lcd_setCursor(0, 0);
 lcd_printStr("SWITCH");
 lcd_setCursor(1, 1);
 lcd_printStr("SCIENCE");
 if (contrastFlag == false) {
  if (++contrast >= 63) {
   contrastFlag = true;
  }
 } else {
  if (--contrast <= 0) {
   contrastFlag = false;
  }
 }
 lcd_setContrast(contrast);
 delay(100);
}
void lcd_cmd(byte x) {
 Wire.beginTransmission(I2Cadr);
 Wire.write(0b00000000); // CO = 0,RS = 0
 Wire.write(x);
 Wire.endTransmission();
}
void lcd_contdata(byte x) {
 Wire.write(0b11000000); // CO = 1, RS = 1
 Wire.write(x);
}
void lcd_lastdata(byte x) {
 Wire.write(0b01000000); // CO = 0, RS = 1
 Wire.write(x);
}
// Show the string.
void lcd_printStr(const char *s) {
 Wire.beginTransmission(I2Cadr);
 while (*s) {
  if (*(s + 1)) {
   lcd_contdata(*s);
  } else {
   lcd_lastdata(*s);
  }
  s++;
 }
 Wire.endTransmission();
}
// Set the character location.
void lcd_setCursor(byte x, byte y) {
 lcd_cmd(0x80 | (y * 0x40 + x));
}
void lcd_setContrast(byte c) {
 lcd_cmd(0x39);
 lcd_cmd(0b01110000 | (c & 0x0f)); // contrast Low
 lcd_cmd(0b01011100 | ((c >> 4) & 0x03)); // contast High/icon/power
 lcd_cmd(0x38);
}