console to LCD

Hi!
I'm trying to write some text to an lcd 1602 from console on linux but with no success.

First, this code works, so I know it's wired properly:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int switchPin = 6;

void setup() {
  // put your setup code here, to run once:
  lcd.begin(12, 2);
  pinMode(switchPin, INPUT);
  lcd.setCursor(0, 0);
  lcd.print("Hello");

}

Now I'm trying to print stuff with this code on the Arduino:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int switchPin = 6;

void setup() {
  lcd.begin(12, 2);
  pinMode(switchPin, INPUT);
  lcd.setCursor(0, 0);
  lcd.print("Hello");

}

void loop() {

  char testData;
  
  if(Serial.available() )
  {
    testData = Serial.read();
    lcd.print(testData);
  }

}

And in the console in linux I type :

echo "Hello!" > /dev/ttyACM0

Something is happening because the screen displays a line of squares and then nothing.
I'm not sure what to do to display text, I'm sorry if this is perhaps linux related more than Arduino. Can someone point me in the right direction please?

I have to add that my initial intention was to print from within puredata, I tried with [comport] with no success (although the RX led was blinking each time I sent some data), so I then went to try and see if it worked from console

You don't say anything about how the Linux machine is connected to the Arduino.

@MK1888 It's an arduino Uno connected via usb port. So I'm just trying to communicate via serial. Tell If there's more info I can give you, I don't know what else I can provide

First try sending data to the Arduino using the serial monitor in the IDE.

You have to use the correct data rate and you have to initialise the serial port in the sketch with Serial.begin(speed). :cold_sweat:

Once you get it working with the serial monitor, you can figure out how to configure the serial port for your other programs.

You need to call Serial.begin(9600); in setup function. See how to send data from PC to Arduino via Serial

Thank you !

Serial.begin(9600) did it!

Sorry I should have seen the HowTo (just didn't appear with a google search)