Hi
I have simple circuit based on the Arduino that controls an LCD and a keypad. All it does is send what ever is pressed on the keypad over the serial port and receives from the serial port to the LCD.
The circuit runs off 12V but the serial is 5v. When I connect a Bluetooth module to the circuit via a 12v to 5v DC-DC converter it works fine I can receive and send on my PC and phone. But when I connect a USB to serial adapter including ground I can send but receive nothing.
The TX LED flashes on the adapter so it gets the signal, but I get nothing on the terminal. When I connect the TX and RX together I get whats on the keypad on the LCD.
Why does this not work with the adapter? Is it because they are power separately even tho ground is connected? If so how come I can send to it?
Here is my code and circuit.
Thanks in advance.
#include <LiquidCrystal.h>
#include <Keypad.h>
LiquidCrystal lcd(10, 9, 8, A5, A4, A3);
//4x4 Matrix key pad
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns
// Define the Keymap
char keys[ROWS][COLS] =
{
{'1', '2', '3', 's'},
{'4', '5', '6', 'c'},
{'7', '8', '9', 'e'},
{'o', '0', 't', 'p'}
};
byte rowPins[ROWS] = { A1, A0, 7, 6 };
byte colPins[COLS] = { 5, 4, 3, 2 };
// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins,
colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Loading...");
}
void loop(){
char key = kpd.getKey();
lcd.setCursor(0, 0);
Serial.setTimeout('1');
while (Serial.available()) {
lcd.clear();
lcd.print(Serial.readString());
}
if (key)
{
// digitalWrite(8, HIGH); // sets the LED on
// delay(100); // waits for a second
// digitalWrite(8, LOW); // sets the LED off
//
tone(21, 3000, 100);
Serial.print(key);
Serial.println ("");
}
}