SerialGSM for GSM shield without SoftwareSerial
SerialGSM
is designed to work with software serial, as you can see that from the class declaration in the SerialGSM.h
header:
class SerialGSM : public SoftwareSerial {
...
};
Unfortunately, changing it to use hardware serial is more complicated than it looks. There are two potential ways you could go about it:
Derive from
HardwareSerial
instead ofSoftwareSerial
. This would give you flexibility, but you'd have to take care of passing all the right data to theHardwareSerial
constructor, which is quite messy.Don't derive from anything. Use the global
Serial
object, and manually replace all serial function calls with theirSerial.xxx()
equivalents. This is probably easier, but it restricts you to a specific serial port.
Both approaches involve quite a lot of coding, so they aren't trivial tasks. It's also important to note that SerialGSM
currently uses the global Serial
object to output debug information. You'd have to remove or modify that before converting to hardware serial, or else it could interfere.
Never mind, i went with the GSM SMS example from arduino 1.0.5 (Don't know the version of arduino IDE that included this) and works fine.
If you are considering using the SerialGSM library there is no need to!
CAUTION: In the Arduino's library, when you declare the phone number, you have to use international format
(Thanks bloomfield for the info you provided in the previous answer)