Hi All,
I am having a bit of a problem with receiving data from the serial port (pin 0&1). I am trying to communicate with an external modem (Telit). I did connect Arduino (RX) to Modem (TX) And Arduino (TX) to Modem (RX). When I connect the modem to the PC, everything works fine the modem is responding with OK and I am able to send SMS. Can I connect the Modem to pin 0&1 and still use the USB to write debug messages? And can anyone please point me in the correct direction?
Thanks in advance!
Pieter
Some code I tried but is not working.
#include <LiquidCrystal.h>
LiquidCrystal LCD(12, 11, 5, 4, 3, 2);
int incomingByte = 0;
#define INLENGTH 16
#define INTERMINATOR 13
char inString[INLENGTH+1];
int inCount;
int i = 0;
void setup(){
// Initialize LCD
LCD.begin(16, 2);
LCD.clear();
LCD.setCursor(0, 0);
LCD.print("LCD STARTUP");
// Initialize Serial Port
Serial.begin(115200);
delay(5000);
Serial.println("AT+CMGF=1");
LCD.setCursor(0, 1);
LCD.print("INITIALIZE DONE.");
delay(1000);
}
void readSerial(){
if (Serial.available() > 0) {
inString[inCount] = Serial.read();
inCount++;
}
if (inString [inCount] == INTERMINATOR) {inCount = 0; LCD.clear(); i = 0;}
while (i <= inCount){
LCD.setCursor(i, 0);
LCD.print(inString[i]);
i++;
}
delay(300);
}
void loop()
{
Serial.println("AT");
delay(300);
readSerial();
}