Hi, how to test software serial example given in software serial library.
Hi, how to test software serial example given in software serial library.
Connect something to the software serial pins that you KNOW outputs data to the serial port in a known format.
e.g another arduino's hardware serial....
robtillaart:
e.g another arduino's hardware serial....
That's one way. A bit hard to debug the other Arduino that way, though. SoftwareSerial on both Arduinos, though, would allow you to debug them both.
Iam triying to send message from gsm modem by connecting software serial pins to tx ,rx pins of gsm module. but it is not working, how to debug the code..here is the code
#include <SoftwareSerial.h>
char phone_no[]="8886477574";
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("AT+CMGF=1");
mySerial.println("Hello, world?");
}
void loop() // run over and over
{
mySerial.print("AT+CMGS="");
mySerial.print(phone_no);
mySerial.println(""");
while(mySerial.read()!='>');
{
mySerial.println("test message from arduinoGSM...Hello");
delay(500);
mySerial.write(0x1A); //Ctrl+Z
delay(1000);
}
}
What you should be doing is to connect your gsm shield directly to an ftid USB ttl adapter. You then use the gsm shield on a PC. Don't use arduino. Your code shows that you are just a noob. Avoid arduino, test to make sure gsm shield works on PC, then use arduino. The adapter is a few USD on eBay.
but i want to test the software serial pins of arduino
prathiba_view360:
but i want to test the software serial pins of arduino
But have you tested the gsm shield and made sure it worked? If not, why are you using an unknown piece of hardware with software serial, which you also personally haven't figured out yet? Tell us what you know about the shield.
yes, i tested the gsm modem with hardware serial port pins(tx,rx pins connected to modem) of arduino using AT commands it is working. so similarly i want to test the software serial pins.
yes, i tested the gsm modem with hardware serial port pins(tx,rx pins connected to modem) of arduino using AT commands it is working. so similarly i want to test the software serial pins.
That code should do that. The fact that it does not means that your shield is not connecting the modem to pins 10 and 11.
By the way, what the f**k do you expect the modem to do with "Hello, world?"?
Cool down Paul, you're probably right.
So how did you connect the shield to use the pin 10, 11? Most shields I see just hard wire the serial to 0 and 1.
i connected the shields rx, tx pins to the arduino 10 and 11 pins.
prathiba_view360:
i connected the shields rx, tx pins to the arduino 10 and 11 pins.
Then are the shield rx tx disconnected from pins 0 and 1?
Also, you seem to set up pin 10 as rx, that is, receiving from shield. then shouldnt you have connected shield tx to pin 10?