Pages: [1]   Go Down
Author Topic: LCD 16x2 with Max/MSP - problems with typing on bottom line.  (Read 1510 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
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.
 
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// 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:
  Serial.begin(38400);
}

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

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 615
Posts: 49411
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: