I made the project “arduino remotely controlled sockets”, and i just have a little problem, out of space, and I dont know if theres any more errors. im counting upon the community’s help. Thanks!
#include <GSM.h>
int AtransistorPin = 13;
int BtransistorPin = 12;
int CtransistorPin = 11;
int DtransistorPin = 10;
#define PINNUMBER ""
char senderNumber[20];
GSM gsmAccess;
GSM_SMS sms;
char remoteNumber[20] = "+639107993724";
char txtMsgA[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-ACTIVE S3-ACTIVE S4-ACTIVE All Sockets are active";
char txtMsgB[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-INACTIVE S3-INACTIVE S4-INACTIVE All Sockets are inactive";
char txtMsgC[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-ACTIVE S3-ACTIVE S4-ACTIVE";
char txtMsgD[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-INACTIVE S3-INACTIVE S4-INACTIVE";
char txtMsgE[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-INACTIVE S3-ACTIVE S4-ACTIVE";
char txtMsgF[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-ACTIVE S3-INACTIVE S4-INACTIVE";
char txtMsgG[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-ACTIVE S3-INACTIVE S4-ACTIVE";
char txtMsgH[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-INACTIVE S3-ACTIVE S4-INACTIVE";
char txtMsgI[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-ACTIVE S3-ACTIVE S4-INACTIVE";
char txtMsgJ[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-INACTIVE S3-INACTIVE S4-ACTIVE";
char txtMsgK[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-ACTIVE S3-ACTIVE S4-INACTIVE";
char txtMsgL[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-INACTIVE S3-INACTIVE S4-ACTIVE";
char txtMsgM[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-INACTIVE S3-ACTIVE S4-INACTIVE";
char txtMsgN[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-ACTIVE S3-INACTIVE S4-ACTIVE";
char txtMsgO[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-INACTIVE S2-ACTIVE S3-INACTIVE S4-INACTIVE";
char txtMsgP[200] = "Arduino Remotely controlled Sockets. Status Report as of now: S1-ACTIVE S2-INACTIVE S3-ACTIVE S4-ACTIVE";
void setup() {
boolean notConnected = true;
// Start GSM connection
while (notConnected) {
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
}
}
//sets transistorPin as an output, turns off transistor as setup
pinMode(AtransistorPin, OUTPUT);
pinMode(BtransistorPin, OUTPUT);
pinMode(CtransistorPin, OUTPUT);
pinMode(DtransistorPin, OUTPUT);
digitalWrite (AtransistorPin, LOW);
digitalWrite (BtransistorPin, LOW);
digitalWrite (CtransistorPin, LOW);
digitalWrite (DtransistorPin, LOW);
}
void loop() {
char c;
if (sms.available()) {
sms.remoteNumber(senderNumber, 20);
if (sms.peek() == '#') {
sms.flush();
}
char c;
String received = "";
{ while (c = sms.read())
received += c;
Serial.print(c);
if (received.compareTo("on") == 0) {
digitalWrite(AtransistorPin, HIGH);
digitalWrite(BtransistorPin, HIGH);
digitalWrite(CtransistorPin, HIGH);
digitalWrite(DtransistorPin, HIGH);
}
if (received.compareTo("off") == 0) {
digitalWrite(AtransistorPin, LOW);
digitalWrite(BtransistorPin, LOW);
digitalWrite(CtransistorPin, LOW);
digitalWrite(DtransistorPin, LOW);
}
if (received.compareTo("on 1") == 0) {
digitalWrite(AtransistorPin, HIGH);
}
if (received.compareTo("on 2") == 0) {
digitalWrite(BtransistorPin, HIGH);
}
if (received.compareTo("on 3") == 0) {
digitalWrite(CtransistorPin, HIGH);
}
if (received.compareTo("on 4") == 0) {
digitalWrite(DtransistorPin, HIGH);
}
if (received.compareTo("off 1") == 0) {
digitalWrite(AtransistorPin, LOW);
}
if (received.compareTo("off 2") == 0) {
digitalWrite(BtransistorPin, LOW);
}
if (received.compareTo("off 3") == 0) {
digitalWrite(CtransistorPin, LOW);
}
if (received.compareTo("off 4") == 0) {
digitalWrite(DtransistorPin, LOW);
}
if (received.compareTo("STATUS") == 0) {
if (AtransistorPin == HIGH); (BtransistorPin == HIGH); (CtransistorPin == HIGH); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgA);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == LOW); (CtransistorPin == LOW); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgB);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == HIGH); (CtransistorPin == HIGH); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgC);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == LOW); (CtransistorPin == LOW); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgD);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == LOW); (CtransistorPin == HIGH); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgE);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == HIGH); (CtransistorPin == LOW); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgF);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == HIGH); (CtransistorPin == LOW); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgG);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == LOW); (CtransistorPin == HIGH); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgH);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == HIGH); (CtransistorPin == HIGH); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgI);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == LOW); (CtransistorPin == LOW); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgJ);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == HIGH); (CtransistorPin == HIGH); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgK);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == LOW); (CtransistorPin == LOW); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgL);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == LOW); (CtransistorPin == HIGH); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgM);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == HIGH); (CtransistorPin == LOW); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgN);
sms.endSMS();
}
if (AtransistorPin == LOW); (BtransistorPin == HIGH); (CtransistorPin == LOW); (DtransistorPin == LOW); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgO);
sms.endSMS();
}
if (AtransistorPin == HIGH); (BtransistorPin == LOW); (CtransistorPin == HIGH); (DtransistorPin == HIGH); {
sms.beginSMS(remoteNumber);
sms.print(txtMsgP);
sms.endSMS();
}
}
}
delay (500);
sms.flush();
}
delay(1000);
}