Pages: [1]   Go Down
Author Topic: Arduio-LCD string issues  (Read 567 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Im trying to send a string to arduino from a computer and then from the arduino to the computer
but it keeps sending numbers when I type letters
what code should I use?
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4107
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
what code should I use?
What code were you using?

Don
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

#include <LiquidCrystal.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13;    // pin 13 will control the backlight
String g = "";

void setup()
{
  Serial.begin(9600);
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
  lcd.begin(16,2);   
}

void loop()
{
g = Serial.read();
           // columns, rows.  use 16,2 for a 16x2 LCD, etc.
 
  lcd.setCursor(0,0);           // set cursor to column 0, row 0 (the first row)
  lcd.print(g); 
Serial.print(g);  // change this text to whatever you like. keep it clean.
 

delay(400);
 
 
 
 
 
 
 
 
 
}
Logged

Espoo, Finland
Offline Offline
God Member
*****
Karma: 6
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, what you see if you open the serial monitor with correct baudrate, can you send anything, do you get it back?

Cheers,
Kari
Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Pages: [1]   Go Up
Jump to: