if the sketch is made in the libraries Newsoftserial ver 0023 etc,. the sketch will now work in SoftwareSerial? :~
i have no idea if this program works. =( i just want to know how to fix if i get library errors. tnx
how about this one?
#include <SoftwareSerial.h>
#include <string.h>
char messagemo[] = "Hello!!! World!!!";
int rxPin = 0;
int txPin = 1;
// set up a new serial port
SoftwareSerial gsm = SoftwareSerial(rxPin,txPin);
void setup() {
gsm.begin(9600); //begin serial communication
pinMode(rxPin,INPUT); //rx pin 0 for input
pinMode(txPin,OUTPUT); //tx pin 1 for output
gsm.write("AT\r");
delay(1000);
gsm.write("ATE0\r");
delay(1000);
gsm.flush();
gsm.write("AT+CFUN=1\r");
delay(1000);
gsm.flush();
gsm.write("AT+CSDH=0\r");
delay(1000);
gsm.write("AT+CMGF=1\r"); //0 kapag PDU, 1 kapag text
delay(1000);
gsm.flush();
}
i get this error
prog.cpp:1:28: warning: SoftwareSerial.h: No such file or directory
prog:9: error: 'SoftwareSerial' does not name a type
prog.cpp: In function 'void setup()':
prog:13: error: 'gsm' was not declared in this scope
prog.cpp: In function 'void sendSMS(const char*, const char*)':
prog:44: error: 'gsm' was not declared in this scope
prog.cpp: In function 'void deleteSMS()':
prog:56: error: 'gsm' was not declared in this scope
The NewSoftwareSerial class was developed because the old SoftwareSerial class had some serious issues. For 1.0, NewSoftSerial was adopted as an official library, and renamed to SoftwareSerial. So, yes, SoftwareSerial is a direct replacement for NewSoftSerial.
i just want to know how to fix if i get library errors.
This compiles in 1.03 with no errors. I used Sketch->Import Library to import SoftwareSerial.
You should be able to do the same with 1.0. Then add the rest of your code a piece at a time running Sketch->Verify/Compile at each stage. You set yourself up for trouble by throwing a mass of code up before verifying any of it.
PeterH:
The hardware serial is running at 57600 baud so the fact the serial monitor shows rubbish at 4800 is expected. The lower screen shot at 57600 should work, from my understanding of the sketch and your wiring. It correctly shows the output from the local (right) Arduino when you reset it. I assume that the corrupted characters resulted from the reset of the remote (left) Arduino. That should be sending "Hello, world?" but you received something like "C*±±½± °½É± 'ýjRü".
That's not exactly the right number of characters but is roughly the right length, and the "±±" where "ll" should appear suggests that you're seeing a mangled version of the original text.
If you have another USB cable I'd suggest connecting both Arduinos to the PC and open a second instance of the serial monitor to see what you're getting from the left Arduino's hardware serial. It almost looks as if the two boards are running at different speeds or different serial encoding settings, although I don't see any reason why that would happen.
I connected USB cables to both Arduinos.
And I tried both "soft to soft" and "soft to hard" connections, and
both bauds as shown in soft2soft.jpg and soft2hard.jpg.
But, it can't work.
I put screenshots of serial monitors. When I took them, I pushed both
the reset buttons of the Arduinos once each.
In the screenshots, COM16 is the left Arduino in soft2soft.jpg and
soft2hard.jpg, and COM17 is the right.
I changed the Arduinos to new ones, but the result was same.
I can't upload all files for the maximum attachment size allowed, so I do only files of "soft to soft".
I'll upload files of "soft to hard" in my next comment.
More troubleshooting then. Time to nail down when and where the failure takes place.
Maybe try a delay() before and after Serial.begin() in setup()?
Or hold up soft-soft serial until user-i/o from serial monitor transmits "GO" in response to prompt and led 13 ON on both UNO's to show each is initialized?