Go Down

Topic: Arduio-LCD string issues (Read 749 times) previous topic - next topic

tomer1510

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?

floresta

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

Don

tomer1510

#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);
 
 
 
 
 
 
 
 
 
}

GaryP

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

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy