2nd "if" condition is skipping

Hi -

We have implemented a code basically to trigger the range value of VL6180X, when Lux levels reach 2 targeted levels, the 1st level message is getting triggered but the 2nd level trigger is getting skipped, no able to figure out reason, pl do help me in debugging the error(enclosing the code for your reference)

Best,

Ramesha

#include <SoftwareSerial.h>
SoftwareSerial GPRS(10, 11);// RX, TX
#include <Wire.h>
#include "Adafruit_VL6180X.h"
Adafruit_VL6180X vl = Adafruit_VL6180X();
int error = 0, i = 0, sample = 10, k = 0, l = 0, j = 0, start = 0, sms = 0, sms1 = 0;
int value = 0, reference = 71; //71-change 66,60,64//74
//22-08-18
int lux;
String a = "Message1 ";
String e = "Message2 ";
String b = "Message3 ";
String c = "Message4 ";
String d = " Message5 ";
String f = "lux:";
String contact[7] {
"8123745416",
};
void setup()
{

GPRS.begin(115200);
Serial.begin(115200);
GPRS.println("AT");//AT commands
delay( 2500);
GPRS.println("AT+CMGF=1");//AT for messages mode
delay( 2500);
if (! vl.begin()) {
Serial.println("sensor not found");
errorsms(1);
};
// value = sensorCheck();
Serial.print("Reference- value = ");
Serial.println(value);
delay(600000);//10-minutes delay
start = 0;
sms = 1, sms1 = 1;
}
void loop()
{
i = 0, k = 0, l = 0, j = 0;
value = sensorCheck();
Serial.print("continous- value = ");
Serial.println(value);
if ((lux >= 1001 && lux <= 1450)) {
Serial.print("Thickness Range");
start = 1;
}
if ((lux >= 750 && lux <= 1000))
{ Serial.print("System health OK");
start = 2;
}
if (start == 1)
{ if (sms1 == 1)
{
Serial.print("smsreference==== ");
Serial.println(value);
SMS (value);
start = 0;
sms1++;
}
}
if (start == 2)
{
if (sms == 1)
{
Serial.print("SMS System ==== ");
Serial.println(value);
SMS (value);
start = 0;
sms++;
}
}
}
int sensorCheck()
{
Serial.print("checking ");
// Serial.println(value);
float range = 0;
uint8_t status;
while (i < sample) {
lux = vl.readLux(VL6180X_ALS_GAIN_1);

range = vl.readRange();
status = vl.readRangeStatus();
// range = range * 0.9;
// Serial.print("status");Serial.println(status);
if (status == VL6180X_ERROR_NONE) {
// Serial.print("Range: "); Serial.println(range);
}
// Some error occurred, print it out!
if ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) {
Serial.println("System error");
errorsms(2);
}
else if (status == VL6180X_ERROR_ECEFAIL) {
Serial.println("ECE failure");
errorsms(3);
}
else if (status == VL6180X_ERROR_NOCONVERGE) {
Serial.println("No convergence");
errorsms(4);
}
else if (status == VL6180X_ERROR_RANGEIGNORE) {
Serial.println("Ignoring range");
errorsms(5);
}
else if (status == VL6180X_ERROR_SNR) {
Serial.println("Ambient conditions too high ");
errorsms(6);
}
else if (status == VL6180X_ERROR_RAWUFLOW) {
Serial.println("Raw reading underflow");
errorsms(7);
}
else if (status == VL6180X_ERROR_RAWOFLOW) {
Serial.println("Raw reading overflow");
errorsms(8);
}
else if (status == VL6180X_ERROR_RANGEUFLOW) {
Serial.println("Range reading underflow");
errorsms(9);
}
else if (status == VL6180X_ERROR_RANGEOFLOW) {
Serial.println("Range reading overflow");
errorsms(10);
}
// delay(100);
k = k + range;
i++;
}
l = k / sample;
Serial.println(l);
j = reference - l;
Serial.print("Lux: "); Serial.println(lux);

return j;

}

void SMS(int Thickness) {
int mem = 0;
Serial.flush();
GPRS.flush();
delay(2000);
Serial.print("Thickness=");
Serial.println(Thickness);
if ( Thickness >= 0 && Thickness < 10) mem = 7;
else if ( Thickness >= 10 && Thickness < 20) mem = 7;
else if ( Thickness >= 20 && Thickness < 30) mem = 7;
else if ( Thickness >= 30) mem = 7;
else mem = 7;
// if ( Thickness >= 11 && Thickness < sample)Thickness =Thickness - 10;
for (int i = 0; i < mem; i++) {
Serial.println(i);
GPRS.println("AT+CMGF=1\r");
delay(1000);
Serial.println(contact*);*
_ Serial.println("AT+CMGS="+91" + contact + ""\r");_
_ GPRS.println("AT+CMGS="+91" + contact + ""\r");
* delay(1000);
if (Thickness >= 0 && Thickness <= 9) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
else if (Thickness >= 10 && Thickness < 20) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
else if ( Thickness >= 20 && Thickness < 30) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.println(c);
Serial.println(c);
}
else if (Thickness >= 30) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.println(d);
Serial.println(d);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
else {
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.println(e);
Serial.println(e);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
delay(100);
GPRS.write( 0x1a ); // ctrl+Z character*
* GPRS.println((char)26);
delay(10000);
}
}
int errorsms(int error) {//error sms
String f = "Failed to find sensor";
String g = "System error";
String h = " laser convergence estimate fail";
String m = "No convergence of laser triangulation";
String n = "Ignoring range";
String o = "Ambient light too high";
String p = "Range underflow";
String q = "Range overflow";
for (int i = 0; i < 6; i++) {
Serial.println(contact);
Serial.println("AT+CMGS="+91" + contact + ""\r");
GPRS.println("AT+CMGS="+91" + contact + ""\r");
delay(1000);
if (error == 1) {
GPRS.println(f);
Serial.println(f);
}
else if (error == 2) {
GPRS.println(g);
Serial.println(g);
}
else if (error == 3) {
GPRS.println(h);
Serial.println(h);
}
else if (error == 4) {
GPRS.println(m);
Serial.println(m);
}
else if (error == 5) {
GPRS.println(n);
Serial.println(n);
}
else if (error == 6) {
GPRS.println(o);
Serial.println(o);
}
else if (error == 7 || error == 9) {
GPRS.println(p);
Serial.println(p);
}
else if (error == 8 || error == 10) {
GPRS.println(q);
Serial.println(q);
}
delay(100);
GPRS.write( 0x1a ); // ctrl+Z character*

* GPRS.println((char)26);
delay(10000);
}
start = 8;
}
prg-1.ino (7.01 KB)*_

  • There is a smiley with sunglasses and italic in your code.. this is totally unreadable. Please read how to use the forum to post correctly.

  • Given the code is long, explain where it is you think the if do not work


Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

I don't know, how smiley cropped in! it is (8);

The code is below,do not where the error is

void loop()
{
i = 0, k = 0, l = 0, j = 0;
value = sensorCheck();
Serial.print("continous- value = ");
Serial.println(value);
if ((lux >= 1001 && lux <= 1450)) {
Serial.print("Thickness Range");
start =1;
}
if((lux >= 750 && lux <= 1000))
{Serial.print("System health OK");
start =2;
}
if(start==1)
{ if(sms1==1)
{
Serial.print("smsreference==== ");
Serial.println(value);
SMS (value);
start =0;
sms1++;
}
}
if(start==2)
{
if(sms==1)
{
Serial.print("SMS System ==== ");
Serial.println(value);
SMS (value);
start =0;
sms++;
}
}
}

rockwellramesha:
I don't know, how smiley cropped in! it is (8);

The code is below,do not where the error is

You have just been told why the smiley appeared in the code. You have failed to post your code correctly after being told how to do that. If you cannot follow simple instructions, you will not be able to write code, so maybe you should choose another hobby.

I'm out of that conversation

#include <SoftwareSerial.h>
SoftwareSerial GPRS(10, 11);// RX, TX
#include <Wire.h>
#include "Adafruit_VL6180X.h"
Adafruit_VL6180X vl = Adafruit_VL6180X();
int error = 0, i = 0, sample = 10, k = 0, l = 0, j = 0, start = 0, sms = 0, sms1 = 0;
int value = 0, reference = 71; //71-change 66,60,64//74
//22-08-18
int lux;
String a = "Message1 ";
String e = "Message2 ";
String b = "Message3 ";
String c = "Message4 ";
String d = " Message5 ";
String f = "lux:";
String contact[7] {
"8123745416",
};
void setup()
{

GPRS.begin(115200);
Serial.begin(115200);
GPRS.println("AT");//AT commands
delay( 2500);
GPRS.println("AT+CMGF=1");//AT for messages mode
delay( 2500);
if (! vl.begin()) {
Serial.println("sensor not found");
errorsms(1);
};
// value = sensorCheck();
Serial.print("Reference- value = ");
Serial.println(value);
delay(600000);//10-minutes delay
start = 0;
sms = 1, sms1 = 1;
}
void loop()

code:[

{
i = 0, k = 0, l = 0, j = 0;
value = sensorCheck();
Serial.print("continous- value = ");
Serial.println(value);
if ((lux >= 1001 && lux <= 1450)) {
Serial.print("Thickness Range");
start = 1;
}
if ((lux >= 750 && lux <= 1000))
{ Serial.print("System health OK");
start = 2;
}
if (start == 1)
{ if (sms1 == 1)
{
Serial.print("smsreference==== ");
Serial.println(value);
SMS (value);
start = 0;
sms1++;
}
}
if (start == 2)
{
if (sms == 1)
{
Serial.print("SMS System ==== ");
Serial.println(value);
SMS (value);
start = 0;
sms++;
}
}
}

/code

int sensorCheck()
{
Serial.print("checking ");
// Serial.println(value);
float range = 0;
uint8_t status;
while (i < sample) {
lux = vl.readLux(VL6180X_ALS_GAIN_1);

range = vl.readRange();
status = vl.readRangeStatus();
// range = range * 0.9;
// Serial.print("status");Serial.println(status);
if (status == VL6180X_ERROR_NONE) {
// Serial.print("Range: "); Serial.println(range);
}
// Some error occurred, print it out!
if ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) {
Serial.println("System error");
errorsms(2);
}
else if (status == VL6180X_ERROR_ECEFAIL) {
Serial.println("ECE failure");
errorsms(3);
}
else if (status == VL6180X_ERROR_NOCONVERGE) {
Serial.println("No convergence");
errorsms(4);
}
else if (status == VL6180X_ERROR_RANGEIGNORE) {
Serial.println("Ignoring range");
errorsms(5);
}
else if (status == VL6180X_ERROR_SNR) {
Serial.println("Ambient conditions too high ");
errorsms(6);
}
else if (status == VL6180X_ERROR_RAWUFLOW) {
Serial.println("Raw reading underflow");
errorsms(7);
}
else if (status == VL6180X_ERROR_RAWOFLOW) {
Serial.println("Raw reading overflow");
errorsms(8);
}
else if (status == VL6180X_ERROR_RANGEUFLOW) {
Serial.println("Range reading underflow");
errorsms(9);
}
else if (status == VL6180X_ERROR_RANGEOFLOW) {
Serial.println("Range reading overflow");
errorsms(10);
}
// delay(100);
k = k + range;
i++;
}
l = k / sample;
Serial.println(l);
j = reference - l;
Serial.print("Lux: "); Serial.println(lux);

return j;

}

void SMS(int Thickness) {
int mem = 0;
Serial.flush();
GPRS.flush();
delay(2000);
Serial.print("Thickness=");
Serial.println(Thickness);
if ( Thickness >= 0 && Thickness < 10) mem = 7;
else if ( Thickness >= 10 && Thickness < 20) mem = 7;
else if ( Thickness >= 20 && Thickness < 30) mem = 7;
else if ( Thickness >= 30) mem = 7;
else mem = 7;
// if ( Thickness >= 11 && Thickness < sample)Thickness =Thickness - 10;
for (int i = 0; i < mem; i++) {
Serial.println(i);
GPRS.println("AT+CMGF=1\r");
delay(1000);
Serial.println(contact*);*
_ Serial.println("AT+CMGS="+91" + contact + ""\r");_
_ GPRS.println("AT+CMGS="+91" + contact + ""\r");
* delay(1000);
if (Thickness >= 0 && Thickness <= 9) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
else if (Thickness >= 10 && Thickness < 20) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
else if ( Thickness >= 20 && Thickness < 30) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.println(c);
Serial.println(c);
}
else if (Thickness >= 30) {
GPRS.println(a);
Serial.println(a);
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.println(d);
Serial.println(d);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
else {
GPRS.print(Thickness);// The SMS value*
* Serial.println(Thickness);
GPRS.println(b);
Serial.println(b);
GPRS.println(e);
Serial.println(e);
GPRS.print(f);
Serial.print(f);
GPRS.println(lux);
Serial.println(lux);
}
delay(100);
GPRS.write( 0x1a ); // ctrl+Z character*
* GPRS.println((char)26);
delay(10000);
}
}
int errorsms(int error) {//error sms
String f = "Failed to find sensor";
String g = "System error";
String h = " laser convergence estimate fail";
String m = "No convergence of laser triangulation";
String n = "Ignoring range";
String o = "Ambient light too high";
String p = "Range underflow";
String q = "Range overflow";
for (int i = 0; i < 6; i++) {
Serial.println(contact);
Serial.println("AT+CMGS="+91" + contact + ""\r");
GPRS.println("AT+CMGS="+91" + contact + ""\r");
delay(1000);
if (error == 1) {
GPRS.println(f);
Serial.println(f);
}
else if (error == 2) {
GPRS.println(g);
Serial.println(g);
}
else if (error == 3) {
GPRS.println(h);
Serial.println(h);
}
else if (error == 4) {
GPRS.println(m);
Serial.println(m);
}
else if (error == 5) {
GPRS.println(n);
Serial.println(n);
}
else if (error == 6) {
GPRS.println(o);
Serial.println(o);
}
else if (error == 7 || error == 9) {
GPRS.println(p);
Serial.println(p);
}
else if (error == 8 || error == 10) {
GPRS.println(q);
Serial.println(q);
}
delay(100);
GPRS.write( 0x1a ); // ctrl+Z character*

* GPRS.println((char)26);
delay(10000);
}
start = 8;
}
// red-vin*

//black- gnd
//orange - scl
//brown- sda
//yellow- 0
//green-1 time-5:55_

code:

#include <SoftwareSerial.h>
SoftwareSerial GPRS(10, 11);// RX, TX
#include <Wire.h>
#include "Adafruit_VL6180X.h"
Adafruit_VL6180X vl = Adafruit_VL6180X();
int  error = 0, i = 0, sample = 10, k = 0, l = 0, j = 0, start = 0, sms = 0, sms1 = 0;
int value = 0, reference = 71; //71-change 66,60,64//74
//22-08-18
int lux;
String a = "Message1 ";
String e = "Message2 ";
String b = "Message3  ";
String c = "Message4 ";
String d = " Message5 ";
String f = "lux:";
String contact[7] {
  "8123745416",
};
void setup()
{

  GPRS.begin(115200);
  Serial.begin(115200);
  GPRS.println("AT");//AT commands
  delay( 2500);
  GPRS.println("AT+CMGF=1");//AT for messages mode
  delay( 2500);
  if (! vl.begin()) {
    Serial.println("sensor not found");
    errorsms(1);
  };
  //  value = sensorCheck();
  Serial.print("Reference- value = ");
  Serial.println(value);
  delay(600000);//10-minutes delay
  start = 0;
  sms = 1, sms1 = 1;
}
void loop()
{
  i = 0, k = 0, l = 0, j = 0;
  value = sensorCheck();
  Serial.print("continous- value = ");
  Serial.println(value);
  if ((lux >= 1001 && lux <= 1450)) {
    Serial.print("Thickness Range");
    start = 1;
  }
  if ((lux >= 750 && lux <= 1000))
  { Serial.print("System health OK");
    start = 2;
  }
  if (start == 1)
  { if (sms1 == 1)
    {
      Serial.print("smsreference==== ");
      Serial.println(value);
      SMS (value);
      start = 0;
      sms1++;
    }
  }
  if (start == 2)
  {
    if (sms == 1)
    {
      Serial.print("SMS System ==== ");
      Serial.println(value);
      SMS (value);
      start = 0;
      sms++;
    }
  }
}
int sensorCheck()
{
  Serial.print("checking ");
  //    Serial.println(value);
  float range = 0;
  uint8_t status;
  while (i < sample) {
    lux = vl.readLux(VL6180X_ALS_GAIN_1);

    range = vl.readRange();
    status = vl.readRangeStatus();
    //    range = range * 0.9;
    //    Serial.print("status");Serial.println(status);
    if (status == VL6180X_ERROR_NONE) {
      //    Serial.print("Range: "); Serial.println(range);
    }
    // Some error occurred, print it out!
    if  ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) {
      Serial.println("System error");
      errorsms(2);
    }
    else if (status == VL6180X_ERROR_ECEFAIL) {
      Serial.println("ECE failure");
      errorsms(3);
    }
    else if (status == VL6180X_ERROR_NOCONVERGE) {
      Serial.println("No convergence");
      errorsms(4);
    }
    else if (status == VL6180X_ERROR_RANGEIGNORE) {
      Serial.println("Ignoring range");
      errorsms(5);
    }
    else if (status == VL6180X_ERROR_SNR) {
      Serial.println("Ambient conditions too high ");
      errorsms(6);
    }
    else if (status == VL6180X_ERROR_RAWUFLOW) {
      Serial.println("Raw reading underflow");
      errorsms(7);
    }
    else if (status == VL6180X_ERROR_RAWOFLOW) {
      Serial.println("Raw reading overflow");
      errorsms(8);
    }
    else if (status == VL6180X_ERROR_RANGEUFLOW) {
      Serial.println("Range reading underflow");
      errorsms(9);
    }
    else if (status == VL6180X_ERROR_RANGEOFLOW) {
      Serial.println("Range reading overflow");
      errorsms(10);
    }
    //    delay(100);
    k = k + range;
    i++;
  }
  l = k / sample;
  Serial.println(l);
  j = reference - l;
  Serial.print("Lux: "); Serial.println(lux);

  return j;

}

void SMS(int Thickness) {
  int mem = 0;
  Serial.flush();
  GPRS.flush();
  delay(2000);
  Serial.print("Thickness=");
  Serial.println(Thickness);
  if ( Thickness >= 0 && Thickness < 10) mem = 7;
  else if ( Thickness >= 10 && Thickness < 20) mem = 7;
  else if ( Thickness >= 20 && Thickness < 30) mem = 7;
  else if ( Thickness >= 30) mem = 7;
  else  mem = 7;
  //  if ( Thickness >= 11 && Thickness < sample)Thickness =Thickness - 10;
  for (int i = 0; i < mem; i++) {
    Serial.println(i);
    GPRS.println("AT+CMGF=1\r");
    delay(1000);
    Serial.println(contact[i]);
    Serial.println("AT+CMGS=\"+91" + contact[i] + "\"\r");
    GPRS.println("AT+CMGS=\"+91" + contact[i] + "\"\r");
    delay(1000);

    if (Thickness >= 0 && Thickness <= 9) {
      GPRS.println(a);
      Serial.println(a);
      GPRS.print(Thickness);// The SMS value
      Serial.println(Thickness);
      GPRS.println(b);
      Serial.println(b);
      GPRS.print(f);
      Serial.print(f);
      GPRS.println(lux);
      Serial.println(lux);
    }
    else if (Thickness >= 10 && Thickness < 20) {
      GPRS.println(a);
      Serial.println(a);
      GPRS.print(Thickness);// The SMS value
      Serial.println(Thickness);
      GPRS.println(b);
      Serial.println(b);
      GPRS.print(f);
      Serial.print(f);
      GPRS.println(lux);
      Serial.println(lux);
    }
    else if ( Thickness >= 20 && Thickness < 30) {
      GPRS.println(a);
      Serial.println(a);
      GPRS.print(Thickness);// The SMS value
      Serial.println(Thickness);
      GPRS.println(b);
      Serial.println(b);
      GPRS.println(c);
      Serial.println(c);
    }
    else if (Thickness >= 30) {
      GPRS.println(a);
      Serial.println(a);
      GPRS.print(Thickness);// The SMS value
      Serial.println(Thickness);
      GPRS.println(b);
      Serial.println(b);
      GPRS.println(d);
      Serial.println(d);
      GPRS.print(f);
      Serial.print(f);
      GPRS.println(lux);
      Serial.println(lux);
    }

    else  {

      GPRS.print(Thickness);// The SMS value
      Serial.println(Thickness);
      GPRS.println(b);
      Serial.println(b);
      GPRS.println(e);
      Serial.println(e);
      GPRS.print(f);
      Serial.print(f);
      GPRS.println(lux);
      Serial.println(lux);

    }

    delay(100);
    GPRS.write( 0x1a ); // ctrl+Z character
    GPRS.println((char)26);
    delay(10000);
  }
}
int errorsms(int error) {//error sms
  String f = "Failed to find sensor";
  String g = "System error";
  String h = " laser convergence estimate fail";
  String m = "No convergence of laser triangulation";
  String n = "Ignoring range";
  String o = "Ambient light too high";
  String p = "Range underflow";
  String q = "Range overflow";
  for (int i = 0; i < 6; i++) {
    Serial.println(contact[i]);
    Serial.println("AT+CMGS=\"+91" + contact[i] + "\"\r");
    GPRS.println("AT+CMGS=\"+91" + contact[i] + "\"\r");
    delay(1000);
    if (error == 1) {
      GPRS.println(f);
      Serial.println(f);
    }

    else if (error == 2) {
      GPRS.println(g);
      Serial.println(g);
    }

    else if (error == 3) {
      GPRS.println(h);
      Serial.println(h);
    }
    else if (error == 4) {
      GPRS.println(m);
      Serial.println(m);
    }
    else if (error == 5) {
      GPRS.println(n);
      Serial.println(n);
    }
    else if (error == 6) {
      GPRS.println(o);
      Serial.println(o);
    }
    else if (error == 7 || error == 9) {
      GPRS.println(p);
      Serial.println(p);
    }
    else if (error == 8 || error == 10) {
      GPRS.println(q);
      Serial.println(q);
    }
    delay(100);
    GPRS.write( 0x1a ); // ctrl+Z character
    GPRS.println((char)26);
    delay(10000);
  }
  start = 8;
}
// red-vin
//black- gnd
//orange - scl
//brown- sda
//yellow- 0
//green-1 time-5:55

Which second if condition is skipping?

code:

Serial.print("Reference- value = ");
Serial.println(value);
delay(600000);//10-minutes delay
start = 0;
sms = 1, sms1 = 1;
}
void loop()
{
i = 0, k = 0, l = 0, j = 0;
value = sensorCheck();
Serial.print("continous- value = ");
Serial.println(value);
if ((lux >= 1001 && lux <= 1450)) {
Serial.print("Thickness Range");
start = 1;
}
if ((lux >= 750 && lux <= 1000))
{ Serial.print("System health OK");
start = 2;
}
if (start == 1)
{ if (sms1 == 1)
{
Serial.print("smsreference==== ");
Serial.println(value);
SMS (value);
start = 0;
sms1++;
}
}
if (start == 2)
{
if (sms == 1)
{
Serial.print("SMS System ==== ");
Serial.println(value);
SMS (value);
start = 0;
sms++;
}
}
}

/code

@rockwellramesha, you managed to post the code properly in Reply #6 - please do it like that every time.

...R

Serial.print("Reference- value = ");
  Serial.println(value);
  delay(600000);//10-minutes delay
  start = 0;
  sms = 1, sms1 = 1;
}
void loop()
{
  i = 0, k = 0, l = 0, j = 0;
  value = sensorCheck();
  Serial.print("continous- value = ");
  Serial.println(value);
  if ((lux >= 1001 && lux <= 1450)) {
    Serial.print("Thickness Range");
    start = 1;
  }
  if ((lux >= 750 && lux <= 1000))
  { Serial.print("System health OK");
    start = 2;
  }
  if (start == 1)
  { if (sms1 == 1)
    {
      Serial.print("smsreference==== ");
      Serial.println(value);
      SMS (value);
      start = 0;
      sms1++;
    }
  }
  if (start == 2)
  {
    if (sms == 1)
    {
      Serial.print("SMS System ==== ");
      Serial.println(value);
      SMS (value);
      start = 0;
      sms++;
    }
  }
}

You really do seem to be going to a lot of trouble to make it difficult to help you. By now I have forgotten what the problem was and you have been posting code in your last 4 Replies with no dialogue whatever.

You seem to have plenty of print statements in your program so please post an example of the output when you run the program - especially the output that is relevant to the problem.

...R

Robin2:
You really do seem to be going to a lot of trouble to make it difficult to help you. By now I have forgotten what the problem was and you have been posting code in your last 4 Replies with no dialogue whatever.

You seem to have plenty of print statements in your program so please post an example of the output when you run the program - especially the output that is relevant to the problem.

...R

Thanks All -

I, did figure out, there is no issue with the code.

Resolved

rockwellramesha:
I, did figure out, there is no issue with the code.

For the benefit of other readers please explain how you resolved the problem.

...R

rockwellramesha:
I, did figure out, there is no issue with the code.

No surprises there.