I am using RF module and Gsm module in my project. I am able to get working them independently but not together. When I comment virtual wires initialisation in setup gsm code works perfectly, when I un comment there is no any compilation error but gsm don’t receive messages. Please , help thank you.
How are they wired?
Where’s your code ? (in code tags).
#include <VirtualWire.h>
#include <Sim800L.h>
#include <SoftwareSerial.h>
#define RX 10
#define TX 11
Sim800L GSM(RX, TX);
char* text;
char* number;
bool error;
int input_pin = A0;
int buzPin = 8;
int highLimit = 670;
int lowerLimit = 630;
double alpha = 0.75;
int period = 200;
double change = 0.0;
int TX_PIN = 2;
int TX_ID = 3;
typedef struct roverRemoteData
{
int TX_ID;
int Sensor1Data;
};
void setup() {
Serial.begin(9600);
vw_setup(2000);
vw_set_tx_pin(TX_PIN);
pinMode(buzPin,OUTPUT);
}
void loop() {
static double oldValue = 0;
static double oldChange = 0;
int rawValue = analogRead(input_pin);
double value = alpha * oldValue + (1-alpha) * rawValue;
Serial.println(rawValue);
oldValue = value;
delay(period);
struct roverRemoteData payload;
payload.TX_ID = TX_ID;
payload.Sensor1Data = rawValue;
vw_send((uint8_t *)&payload, sizeof(payload));
vw_wait_tx();
if (rawValue > highLimit) {
digitalWrite(buzPin,HIGH);
}
else {
digitalWrite(buzPin,LOW);
}
if (rawValue < lowerLimit) {
GSM.begin(4800);
text="EMERGENCY! Swimmer almost dying!!";
number="+254123456789";
error = GSM.sendSms(number,text);
}
}
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.