DX160 LCD Communications - Please help!!

Hi all,

I am taking a step back in writing the libraries to control the DX160 LCD that sparkfun is offering because I cannot get the SoftwareSerial library to access different pins on Arduino.

In previous posts, you see where I ask how to pass I/O pin numbers to the constructor of SoftwareSerial. The compiler never complained, but I get no data out (or so it seems, the LCD screen doesn’t do anything).

So, I’ve decided to take a step back and do this (for sanity sake):

#include <SoftwareSerial.h>


SoftwareSerial example(2,3);

void drawLine(int x1,int y1,int x2,int y2,boolean color)
{
       int delayTime = 20;
       Serial.print(200,BYTE);
       delay(delayTime); 
       Serial.print(4,BYTE);
       delay(delayTime);  
       Serial.print(x1,BYTE);
       delay(delayTime);
       Serial.print(y1,BYTE);
       delay(delayTime);
       Serial.print(x2,BYTE);
       delay(delayTime);
       Serial.print(y2,BYTE);
       delay(delayTime);
       Serial.print(color,BYTE);
       delay(delayTime);
       Serial.print(200,BYTE);
       delay(delayTime);
}


void setup()
{
    Serial.begin(57600);
  example.begin(57600);
  delay(300); 
}

int x1 = 0;
int x2 = 120;
int y1 = 50;
int y2 = 50;
int color = 1;

void loop()
{
 delay(500);
drawLine(0,10,100,10,1);
  
  delay(1000);
  
  int delayTime = 20;
       example.print(200,BYTE);
       delay(delayTime); 
       example.print(4,BYTE);
       delay(delayTime);  
       example.print(x1,BYTE);
       delay(delayTime);
       example.print(y1,BYTE);
       delay(delayTime);
       example.print(x2,BYTE);
       delay(delayTime);
       example.print(y2,BYTE);
       delay(delayTime);
       example.print(color,BYTE);
       delay(delayTime);
       example.print(200,BYTE);
       delay(delayTime);

}

Hopefully you can see that I have the same function, written twice. This is the “drawLine()” function. It draws a line. Now, in the actual function above, you will see that I use the given “Serial.print(X,Y)” commands, no problems. I pull data from pin1, no problems.

When I try to get data off of pin 3 (example.print(X,Y)), I get nothing.

Does anyone know what to do? I am going insane with this stupid issue…it seems like it should be so simple and yet its not.

In the end, all I want to do is get SoftwareSerial to communicate on different pins (instead of pins 0 and 1). Has anyone out there ever done this?

Thanks

On issue is that your arguments are ints but you are sending bytes. assuming your data will never overflow a byte, try:

void drawLine(byte x1,byte y1,byte byte, byte y2,byte color)

The problem isnt in the drawLine(X,X,X,X) function, it is that I cannot get the TX pin to be anything except on pin 1. I want to create a variable of type SoftwareSerial. In other words...

SoftwareSerial alpha(2,3);

void setup()
{
alpha.begin(57600);
}

void loop()
{
alpha.print(5,BYTE);
}

Only problem is, nothing seems to show up on pin 3 (or 2 for that matter, just in case I had things flipped around).