Skip to main content

temparture gas humiditiy arduino code using iot


 #include <string.h>

 #include <ctype.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);


char fy=0;


// constants won't change. They're used here to
// set pin numbers:

const int buttonPin = 7;     // the number of the pushbutton pin

int buttonState1 = 0;         // variable for reading the pushbutton status

int buttonState2 = 0;         // variable for reading the pushbutton status

int buttonState3 = 0;         // variable for reading the pushbutton status

 int ledPin = 8;                  // LED test pin

 int rxPin = 0;                    // RX PIN

 int txPin = 1;                    // TX TX

 int byteGPS=-1;

 char linea[300] = "";

 char lat[30] = "";

 char lon[30] = "";


 char comandoGPR[7] = "$GPRMC";

 int cont=0;

 int bien=0;

 int conta=0;

 int indices[13];

int sensorValue1 = 0;  // variable to store the value coming from the sensor

int sensorValue2 = 0;  // variable to store the value coming from the sensor

int sensorValue3 = 0;  // variable to store the value coming from the sensor

int sensorValue4 = 0;  // variable to store the value coming from the sensor

int sensorValue5 = 0;  // variable to store the value coming from the sensor

int sensorValue6 = 0;  // variable to store the value coming from the sensor

int sensorValue7 = 0;  // variable to store the value coming from the sensor


int cnt = 0,fl=0,i;  // variable to store the value coming from the sensor

long duration, inches, cm,distance;


void txs(unsigned char val)
{

int i;

Serial.write(val);

for(i=0;i<4000;i++);

}


 void setup()
 {
 
   Serial.begin(9600);
  pinMode (2,OUTPUT);//attach pin 2 to vcc
  pinMode (3,OUTPUT);//attach pin 2 to vcc
  pinMode (9,INPUT);//attach pin 5 to GND
    lcd.begin(16, 2);
 lcd.print("IOT MONITOR        ");
digitalWrite(2,0);
digitalWrite(3,0);
/*

 Serial.print("AT");
         Serial.write(13);
         Serial.write(10);
                  delay(1000);
            Serial.print("AT+CMGF=1");
         Serial.write(13);
         Serial.write(10);
                  delay(1000);
     
   Serial.print("at+cstt=");
      Serial.write('"');
    Serial.print("airtelgprs.com");
     Serial.write('"');  Serial.write(13);  Serial.write(10);
                  delay(2000);

    Serial.print("at+cgatt=1");
    Serial.write(13); Serial.write(10);
                     delay(2000);


  Serial.print("at+cgdcont=1,");
  txs('"');
  Serial.print("IP");
  txs('"');    
  txs(',');  
  txs('"');
    Serial.print("airtelgprs.com");
  txs('"');
  txs(13);txs(10);
                    delay(2000);


  Serial.print("at+cgact=1,1");
  txs(13);txs(10);
                    delay(2000);


  Serial.print("at+cgreg=2");
  txs(13);txs(10);
                    delay(2000);


  Serial.print("AT+CIICR");
   txs(13);txs(10);
                    delay(3000);

  Serial.print("AT+CIFSR");
   txs(13);txs(10);
                    delay(2000);


  Serial.print("AT+CIPHEAD=1");
  txs(13);txs(10);
                    delay(2000);


  Serial.print("AT+SAPBR=3,1,");
  txs('"');
  Serial.print("Contype");
  txs('"');
  txs(',');
  txs('"');
  Serial.print("GPRS");
  txs('"');
  txs(13);txs(10);
    delay(1000);

  Serial.print("AT+SAPBR=3,1,");
  txs('"');
  Serial.print("APN");
  txs('"');
  txs(',');
  txs('"');
  Serial.print("airtelgprs.com");
  txs('"');
  txs(13);txs(10);
    delay(1000);
*/
       pinMode(2, OUTPUT);
         pinMode(3, OUTPUT);
 
 }
long ll;
char f1,f2,f3,f4;

 void loop() {
   //digitalWrite(ledPin, HIGH);

  lcd.setCursor(0, 0);
  lcd.print("Tm:            ");
  lcd.setCursor(8, 0);
  lcd.print("Hu:            ");
  lcd.setCursor(0, 1);
  lcd.print("Gs:            ");


  sensorValue1 = analogRead(A0)/2;
  sensorValue1 = analogRead(A0)/2;
  lcd.setCursor(3, 0);
  lcd.write((sensorValue1/100)+0x30);    
  lcd.write(((sensorValue1%100)/10)+0x30);    
  lcd.write((sensorValue1%10)+0x30);      

  sensorValue2 = analogRead(A1)/2;
  sensorValue2 = analogRead(A1)/2;
  lcd.setCursor(12, 0);
  lcd.write((sensorValue2/100)+0x30);    
  lcd.write(((sensorValue2%100)/10)+0x30);    
  lcd.write((sensorValue2%10)+0x30);      

  sensorValue3 = analogRead(A2)/2;
  sensorValue3 = analogRead(A2)/2;
  lcd.setCursor(3, 1);
  lcd.write((sensorValue3/100)+0x30);    
  lcd.write(((sensorValue3%100)/10)+0x30);    
  lcd.write((sensorValue3%10)+0x30);      

ll++;

delay(100);

if(ll>50)
  {
  Serial.print("*");
delay(20);
Serial.print("T");
delay(20);
Serial.print("E");
delay(20);
Serial.print("M");
delay(20);
Serial.print("P");
delay(20);
Serial.print("=");
delay(20);
      Serial.write((sensorValue1/100)+0x30);    
      delay(20);
  Serial.write(((sensorValue1%100)/10)+0x30);    
      delay(20);
  Serial.write((sensorValue1%10)+0x30);      
    delay(20);
delay(20);
Serial.print("_");
delay(20);
Serial.print("H");
delay(20);
Serial.print("u");
delay(20);
Serial.print("m");
delay(20);
Serial.print("i");
delay(20);
Serial.print("=");
delay(20);
      Serial.write((sensorValue2/100)+0x30);    
      delay(20);
  Serial.write(((sensorValue2%100)/10)+0x30);    
      delay(20);
  Serial.write((sensorValue2%10)+0x30);      
    delay(20);
    Serial.print("_");
delay(20);
Serial.print("G");
delay(20);
Serial.print("a");
delay(20);
Serial.print("s");
delay(20);
Serial.print("=");
delay(20);
      Serial.write((sensorValue3/100)+0x30);    
      delay(20);
  Serial.write(((sensorValue3%100)/10)+0x30);    
      delay(20);
  Serial.write((sensorValue3%10)+0x30);      
    delay(20);
Serial.print("#");

    /*
  Serial.print("AT+SAPBR=4,1");
  txs(13);txs(10);
    delay(2000);
  Serial.print("AT+SAPBR=1,1");
  txs(13);txs(10);
    delay(2000);
  Serial.print("AT+SAPBR=2,1");
  txs(13);txs(10);
    delay(2000);
  Serial.print("AT+HTTPINIT");
  txs(13);txs(10);
    delay(2000);
  Serial.print("AT+HTTPPARA=");
  txs('"');
  Serial.print("URL");
  txs('"');
  txs(',');
  txs('"');
  Serial.print("http://www.iotclouddata.com/iotlog/spring8.php");
  txs('?');
  txs('A');txs('=');
  txs((sensorValue1/100)+0x30);
  txs(((sensorValue1%100)/10)+0x30);
  txs((sensorValue1%10)+0x30);  
  txs('&');
  txs('B');txs('=');
  txs((sensorValue2/100)+0x30);
  txs(((sensorValue2%100)/10)+0x30);
  txs((sensorValue2%10)+0x30);  
  txs('&');
  txs('C');txs('=');
  txs((sensorValue3/100)+0x30);
  txs(((sensorValue3%100)/10)+0x30);
  txs((sensorValue3%10)+0x30);  
  txs('"');
  txs(13);txs(10);
  delay(2000);
  Serial.print("AT+HTTPPARA=");
  txs('"');
  Serial.print("CID");
  txs('"');
  txs(',');
  txs('1');
  txs(13);txs(10);
    delay(2000);
  Serial.print("AT+HTTPACTION=0");
  txs(13);txs(10);
    delay(4000);
 
*/
  }




 
i=0;
 
 
 
 
 
 }

Comments

  1. Harrah's Cherokee Casino Resort Map & Floor Plans - Mapyro
    Find 화성 출장샵 your way around the casino, find where everything is located with map directions, read customer reviews, 여수 출장안마 and explore detailed information 안동 출장마사지 about 목포 출장샵 the 원주 출장샵

    ReplyDelete

Post a Comment

Popular posts from this blog

Jio

Reliance Jio planning its own  cryptocurrency called JioCoin  elder son Akash Ambani leading the JioCoin project, Reliance Jio plans to build a 50-member team of young professionals to work on blockchain technology, which can also be used to develop applications such as smart contracts and supply chain management logistics

garbage monitoring using arduino code with gsm

#include <SoftwareSerial.h> #include <LiquidCrystal.h> //LiquidCrystal lcd(7, 6, 5, 4, 3, 2); LiquidCrystal lcd(13, 12, 11, 10, 9, 8); SoftwareSerial mySerial(0,1); #define trigPin 2 #define echoPin 3 #define PIR_sensor 4 #define m11 5 #define m12 6 void setup() {    lcd.begin(16, 2);    lcd.print("    Garbage    ");    Serial.println("garbage ");   lcd.setCursor(0,1);   lcd.print("   Open Close    ");   Serial.println(" open close");   delay(3000);   lcd.clear();   //lcd.print(" ");   delay(2000); mySerial.begin(9600); // Setting the baud rate of GSM Module Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);  pinMode(m11, OUTPUT);   pinMode(m12, OUTPUT);   } void loop() {  readPIR();  pingDist();  SendMessage(); } void pingDist ()   {     long duration, distance;...