Maker Pro
Maker Pro

function call not recognised

vish

Nov 12, 2016
8
Joined
Nov 12, 2016
Messages
8
noobie here .. my function calls are giving an error that its not defined in this scope

#include<SoftwareSerial.h>
#include <NewPing.h>
#define TRIGGER_PIN 12 // trigger
#define ECHO_PIN 11 // echo
#define MAX_DISTANCE 200 //dist

SoftwareSerial myserial(9,10);
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

int input1;
int input2;
int input3;
int timer1=1;
int timer2=1;
int timer3=1;
int timer4=1;
int depth;

void setup()


{
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
Serial.begin(9600);
myserial.begin(9600);

}


void loop() {

input1=analogRead(A0);
input2=analogRead(A1);
input3=sonar.ping_cm();
Serial.print("input1=");
Serial.println(input1);
Serial.print("input2");
Serial.println(input2);
if ((input3>13)&&(timer1=1))
{
empty();
timer1=timer1+1;
timer2=1;
}
if ((input3<100)&&(timer2=1))
{
full();
timer2=timer2+1;
timer1=1;
}
if(input1<500)
{
digitalWrite(5,HIGH);
digitalWrite(2,HIGH);
timer3=1;
}
else
{ digitalWrite(2,LOW);
digitalWrite(5,LOW);
delay(500);
if(timer3=1)
{
SendMessage();
timer3=timer3+1;
}
}
if(input2<500)
{
digitalWrite(3,HIGH);
digitalWrite(5,HIGH);
delay(500);
timer4=1;

}
else{
digitalWrite(3,LOW);
digitalWrite(5,LOW);
delay(500);
if(timer4=1)
{
SendMessage();
timer4=timer4+1;
}


}
void empty()


{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+919035349750\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Alert..your water tank is EMPTY");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}



void full()

{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+919035349750\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Your Water tank is full..\t Please turn off the pump");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}


void SendMessage()

{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+919035349750\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Your garden has been Watered just now");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,725
Joined
Nov 17, 2011
Messages
13,725
It might be a bit of help to us if you told us which function call(s) throw the error, and where. :rolleyes:
 

vish

Nov 12, 2016
8
Joined
Nov 12, 2016
Messages
8
It might be a bit of help to us if you told us which function call(s) throw the error, and where. :rolleyes:
thanks for your time herald....
ya i shoud have will take care next time...
this got resolved by the way ...

anyone facing the same problem ... mine got resolved with correct bracketing ...
 
Top