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...

CLOUD WORKFLOW SCHEDULING WITH DEADLINE AND TIME SLOT ALGORITHM

CLOUD WORKFLOW SCHEDULING WITH DEADLINE AND TIME SLOT ALGORITHM Abstract Allocating service capacities in cloud computing is based on the assumption that they are unlimited and can be used at any time. However, available service capacities change with workload and cannot satisfy users’ requests at any time from the cloud provider’s perspective because cloud services can be shared by multiple tasks. Cloud service providers provide available time slots for new user’s requests based on available capacities. In this paper, we consider workflow scheduling with deadline and time slot availability in cloud computing. An iterated heuristic framework is presented for the problem under study which mainly consists of initial solution construction, improvement, and perturbation. Three initial solution construction strategies, two greedy- and fair-based improvement strategies and a perturbation strategy are proposed. Different strategies in the three phases result in several heuristics. ...

MobiContext: A Context-aware Cloud-Based Venue Recommendation Framework

            MobiContext: A Context-aware Cloud-Based Venue Recommendation Framework ABSTRACT  In recent years, recommendation systems have seen significant evolution in the field of knowledge engineering. Most of the existing recommendation systems based their models on collaborative filtering approaches that make them simple to implement. However, performance of most of the existing collaborative filtering-based recommendation system suffers due to the challenges, such as: (a) cold start, (b) data sparseness, and (c) scalability. Moreover, recommendation problem is often characterized by the presence of many conflicting objectives or decision variables, such as users’ preferences and venue closeness. In this paper, we proposed MobiContext , a hybrid cloud-based Bi-Objective Recommendation Framework (BORF) for mobile social networks. The MobiContext utilizes multi-objective optimization techniques to generate personalized recommendat...