SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By Wallen
#43810
Hi all,

So I'm making some headway learning about this DX160.

Everything seems to be working. But when I send a second update to the screen - it just blanks out and seems to die. Not sure if this is my code or what.

It also does then when I try to change my font size. Argh, I wish there was more documentation :)

Any help would be greatly appreciated!
Code: Select all
char incomingByte;  // Serial communication
char tmpOutput[200]; // Store incoming serial communication
char *cursor;
char *str = "";
int count = 0;
int speaker = 9;
int led = 13;
int btn = 10;

void setup() {
  pinMode(speaker, OUTPUT);
  pinMode(led, OUTPUT);
  Serial.begin(57600);
  digitalWrite(led, HIGH);
}

void loop() {
  if (Serial.available() > 0) {
    if (incomingByte != 13) {
      incomingByte = Serial.read();
      tmpOutput[count] = incomingByte;
      count++;
    }
    
    if (incomingByte == 13) {
      clearDisplay();
      say(tmpOutput);
      Serial.print(255, BYTE);delay(10);
      count=0;
      
      delay(2000);
    }
  }
}


void clearDisplay() {
  Serial.print(186, BYTE);
  delay(100);
}

void say(char* text) {
  for(cursor=text; *cursor != '\0'; ++cursor) {
    Serial.print(*cursor, BYTE);
  }
}


void setSmallFont() {
  Serial.print(181, BYTE);
  delay(10);
}

void setLargeFont() {
  Serial.print(180, BYTE);
  delay(10);
}
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]