Go Down

Topic: LCD 16x2 with Max/MSP - problems with typing on bottom line. (Read 1 time) previous topic - next topic


I'm a new user in here - and pretty new to the arduino environment. I am pretty used to building modules in Max/MSP and I want this 16x2 LCD display to show me what I am doing in Max. It all works fine so far, the LCD and the arduino is working and the serial object in max is succesfully converting symbols to ASCII and sending via the serial port.
But I am having trouble with breaking the line and sending symbols to the second line on the display - the bottom line.

I am using the following code on the chip:

This example code is in the public domain.


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(){
    // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // initialize the serial communications:

void loop()
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    // clear the screen
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD


My max patch looks like this, in all its simplicity:


Serial data transmission is relatively slow. You are clearing the screen, reading everything in the buffer, and starting loop over again. It is very unlikely that more than 16 characters will arrive on the serial port, while you are clearing the screen. So, there is never anything to wrap onto the second line.

Go Up