How to use SoftwareSerial in a new class.


I would like to use an instance of SoftwareSerial (declared in the setup) in several fonction of a class i made.

Thx for your help.

src files :

#ifndef GMS_H
#define GMS_H
#include <Arduino.h>
#include "SoftwareSerial.h"

class GSM{

uint8_t TX;
uint8_t RX;
String _phoneNumber;


 GSM(uint8_t TX,uint8_t RX);
 void setPhoneNumber(String phoneNumber);
 String getPhoneNumber();
 void sendSMS(String msg);
 String updateSerial();


I woluld like the GSM constructor to create an instance of SoftwareSerial that is used in the others m├ęthode.

I would also be ok if the SoftwareSerial would be a parameter of the constructor and i guess would use a reference to the SoftwareSerial object declared in the setup/loop.

If you want help with your code, here, post your code here. Why make it hard for members to help you. Read the "how to use this forum-please read" stickies to see how to post your code properly and some hints on what we need to know to help you. See #7 & 11.