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

Android Tutorial

Android  is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc. It contains a  linux-based Operating System ,  middleware  and  key mobile applications . It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions etc. This tutorial is developed for beginners and experienced persons. Let's see the topics of android that we are going to learn. Basics of Android In this fundamental chapter, you will learn about android, its components, how to create first android application, internal of first android application etc. What is Android History and Version Software Stack Core Building Blocks Android Emulator Installing softwares Setup Eclipse Hello Android example Internal Details Dalvik VM AndroidManifest.xml R.java Hide Title Bar Activity and I...

PUNCHING MACHINE

ACCIDENT AVOIDING SYSTEM FOR PUNCHING MACHINE SYNOPSIS The aim of our project is to take a system-wide approach to preventing the machine accident. The system includes not just the machine and the operator; but rather, it includes everything from the initial design of the machine to the training of everyone that is responsible for any aspect of it, to the documentation of all changes, to regular safety audits and a finally a corporate culture of safety-first. Design is the part of a machine's life where the greatest impact can be made in relation to avoiding accidents. The designer should ensure that the machine is safe to set up and operate, safe to install, safe to maintain, safe to repair, and safe to decommission. Although safe operation is usually at the forefront of a designer's mind, safe maintenance and repair should also be a high priority. Around 50% of fatal accidents involving industrial equipment are associated with maintenance activities, and design...

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud Abstract                                                                                                                                                      ...