Wednesday, August 25, 2021

Core Python program for Electric Charge Payment

 def amount(n):

    return lambda a : a * n

    

def amount1(n):

    return lambda a, b, c : a*n + b*c


def amount2(n):

    return lambda a, b, c, d, e: a*n + b*d + c*e

    

    

print("\n\t ELECTRIC BILL")

print("\t1.Domestic\n\t2.Cottage and Tiny Industries\n\t3.Industries\n\t4.Public workshop\n\t5.Private Hospital Institution")

print("\t6.Govt and aided Educational Institutions,Hospitals and Research labs")

a=int(input("\n\tEnter the Category:"))

b=input("\tEnter the service.No:")

c=int(input("\tEnter the No.of units consumed:"))

b=str (input("\tEnter the month:"))

d=str(input("\tIts present month(YES OR NO):"))

if a==1:

    if  c<=100:

        amount="BELOW 100 UNITS FREE CHARGE"

        print("\n\tTotal amount:",amount)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

      

    elif c<=200:

        z=c-100

        x = amount(z)

        amount=(x(1.5))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

        elif d=="NO":

            penalty=100

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed") 

            

    elif c<=500:

        x=amount1(100)

        z=c-200

        amount=(x(2,3,z))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

        elif d=="NO":

            penalty=100

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed") 

            

    elif c>500:

        z=c-500

        x=amount2(100)

        amount=(x(3.5, 4.6, 6.6,300,z))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

        elif d=="NO":

            penalty=100

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed") 

            

elif a==2:

    if c<=500:

        x=amount(c)

        amount=(x(4))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

        elif d=="NO":

            penalty=120

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

    elif c>500:

        x=amount(c)

        amount=(x(4.6))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

        elif d=="NO":

            penalty=120

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

elif a==3:

    x=amount(c)

    amount=(x(6.35))

    if d=="YES":

        print("\n\tE-Charge:",amount)

        print("\tTotal amount:",amount)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

        

    elif d=="NO":

        penalty=120

        total=penalty+amount

        print("\n\tE-Charge:",amount)

        print("\tpenalty:",penalty)

        print("\tTotal amount:",total)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

     

elif a==4:

    if c<=120:

        x=amount(c)

        amount=(x(2.85))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

        

        elif d=="NO":

            penalty=120

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

    elif c>120:

        x=amount(c)

        amount=(x(5.75))

        if d=="YES":

            print("\n\tE-Charge:",amount)

            print("\tTotal amount:",amount)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

        elif d=="NO":

            penalty=120

            total=penalty+amount

            print("\n\tE-Charge:",amount)

            print("\tpenalty:",penalty)

            print("\tTotal amount:",total)

            print("\n\tPls, press the pay button.")

            print("\tAmount payed")

            

elif a==5:

    x=amount(c)

    amount=(x(7.5))

    if d=="YES":

        print("\n\tE-Charge:",amount)

        print("\tTotal amount:",amount)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

    elif d=="NO":

        penalty=120

        total=penalty+amount

        print("\n\tE-Charge:",amount)

        print("\tpenalty:",penalty)

        print("\tTotal amount:",total)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

     

elif a==6:

    x=amount(c)

    amount=(x(5.75))

    if d=="YES":

        print("\n\tE-Charge:",amount)

        print("\tTotal amount:",amount)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

    elif d=="NO":

        penalty=120

        total=penalty+amount

        print("\n\tE-Charge:",amount)

        print("\tpenalty:",penalty)

        print("\tTotal amount:",total)

        print("\n\tPls, press the pay button.")

        print("\tAmount payed")

Output:

ELECTRIC BILL

        1.Domestic

        2.Cottage and Tiny Industries

        3.Industries

        4.Public workshop

        5.Private Hospital Institution

        6.Govt and aided Educational Institutions,Hospitals and Research labs


        Enter the Category:2

        Enter the service.No:TNSW0324T23

        Enter the No.of units consumed:210

        Enter the month:AUGUST

        Its present month(YES OR NO):YES


        E-Charge: 840

        Total amount: 840

        Pls, press the pay button.

        Amount payed

Core Python program for population list in India in recursion method

 print("\n\tIndia population list in year wise")

N=int(input("Enter the no.of years (to recursion):"))

def tri_recursion(k):

    a=2021;a1=1393409038;a2=0.97

    b=2020;b1=1380004385;b2=0.99

    c=2019;c1=1366417754;c2=1.02

    d=2018;d1=1352642280;d2=1.04

    e=2017;e1=1338676785;e2=1.07

    f=2016;f1=1324517249;f2=1.10

    g=2015;g1=1310152403;g2=1.12

    h=2014;h1=1295600772;h2=1.15

    i=2013;i1=1280842125;i2=1.19

    j=2012;j1=1265780247;j2=1.24

    k0=2011;k1=1250287943;k2=1.30

    l=2010;l1=1234281170;l2=1.36

    m=2009;m1=1217726215;m2=1.42

    n=2008;n1=1200669765;n2=1.48

    o=2007;o1=1183209472;o2=1.52

    p=2006;p1=1165486291;p2=1.56

    q=2005;q1=1147609927;q2=1.59

    r=2004;r1=1129623456;r2=1.63

    s=2003;s1=1111523144;s2=1.67

    t=2002;t1=1093317189;t2=1.70

    u=2001;u1=1075000085;u2=1.74

    v=2000;v1=1056575549;v2=1.78

    if(k > 0):

        

        result = k + tri_recursion(k - 1)

        while  True:

            

            if result==1:

                print("\n\tfor pervious years:")

                print("\tYear=",b)

                print("\tPopulation=",b1)

                print("\tGrowth rate",b2)

                break

            elif result==3:

                print("\n\tYear=",c)

                print("\tPopulation=",c1)

                print("\tGrowth rate",c2)

                break

            elif result==6:

                print("\n\tYear=",d)

                print("\tPopulation=",d1)

                print("\tGrowth rate",d2)

                break

            elif result==10:

                print("\n\tYear=",e)

                print("\tPopulation=",e1)

                print("\tGrowth rate",e2)

                break

            elif result==15:

                print("\n\tYear=",f)

                print("\tPopulation=",f1)

                print("\tGrowth rate",f2)

                break

            elif result==21:

                print("\n\tYear=",g)

                print("\tPopulation=",g1)

                print("\tGrowth rate",g2)

                break

            elif result==28:

                print("\n\tYear=",h)

                print("\tPopulation=",h1)

                print("\tGrowth rate",h2)

                break

            elif result==36:

                print("\n\tYear=",i)

                print("\tPopulation=",i1)

                print("\tGrowth rate",i2)

                break

            elif result==45:

                print("\n\tYear=",j)

                print("\tPopulation=",j1)

                print("\tGrowth rate",j2)

                break

            elif result==55:

                print("\n\tYear=",k0)

                print("\tPopulation=",k1)

                print("\tGrowth rate",k2)

                break

            elif result==66:

                print("\n\tYear=",l)

                print("\tPopulation=",l1)

                print("\tGrowth rate",l2)

                break

            elif result==78:

                print("\n\tYear=",m)

                print("\tPopulation=",m1)

                print("\tGrowth rate",m2)

                break

            elif result==91:

                print("\n\tYear=",n)

                print("\tPopulation=",n1)

                print("\tGrowth rate",n2)

                break

            elif result==105:

                print("\n\tYear=",o)

                print("\tPopulation=",o1)

                print("\tGrowth rate",o2)

                break

            elif result==120:

                print("\n\tYear=",p)

                print("\tPopulation=",p1)

                print("\tGrowth rate",p2)

                break

            elif result==136:

                print("\n\tYear=",q)

                print("\tPopulation=",q1)

                print("\tGrowth rate",q2)

                break

            elif result==153:

                print("\n\tYear=",r)

                print("\tPopulation=",r1)

                print("\tGrowth rate",r2)

                break

            elif result==171:

                print("\n\tYear=",s)

                print("\tPopulation=",s1)

                print("\tGrowth rate",s2)

                break

            elif result==190:

                print("\n\tYear=",t)

                print("\tPopulation=",t1)

                print("\tGrowth rate",t2)

                break

            elif result==210:

                print("\n\tYear=",u)

                print("\tPopulation=",u1)

                print("\tGrowth rate",u2)

                break

            elif result==231:

                print("\n\tYear=",v)

                print("\tPopulation=",v1)

                print("\tGrowth rate",v2)

                break

                            

    else:

        result=0

        if result==0:

            print("\n\tpopulation for this year")

            print("\tYear=",a)

            print("\tPopulation=",a1)

            print("\tGrowth rate",a2)

            

    return result

tri_recursion(N)

OUTPUT:

India population list in year wise
Enter the no.of years (to recursion):10

        population for this year
        Year= 2021
        Population= 1393409038
        Growth rate 0.97

        for pervious years:
        Year= 2020
        Population= 1380004385
        Growth rate 0.99

        Year= 2019
        Population= 1366417754
        Growth rate 1.02

        Year= 2018
        Population= 1352642280
        Growth rate 1.04

        Year= 2017
        Population= 1338676785
        Growth rate 1.07

        Year= 2016
        Population= 1324517249
        Growth rate 1.1

        Year= 2015
        Population= 1310152403
        Growth rate 1.12

        Year= 2014
        Population= 1295600772
        Growth rate 1.15

        Year= 2013
        Population= 1280842125
        Growth rate 1.19

        Year= 2012
        Population= 1265780247
        Growth rate 1.24

Core python program for list of hospitals in udumalpet surrounding

 def Subam(name):

    print("Dr."+name)

    print("\tAddress: Subam Clinic Medical Centre, No: 2, Saravana Street, Udumalaipettai, Tamil Nadu 642126")

    print("\tPhone: 04252 222 018")

    return Subam


def sk(name):

    print("Dr."+name)

    print("\tAddress: SK Medical Centre, No:20, Saravana Street, Udumalaipettai, Tamil Nadu 642126")

    print("\tPhone: 04252 232 233")

    return sk

    

def Saravana(name):

    print("Dr."+name)

    print("\tAddress: Saravana Hospital, No:9B, Kalpana Rd, Udumalaipettai, Tamil Nadu 642126")

    return Saravana

    

def Sivakani(name):

    print("Dr."+name)

    print("\tAddress: Sivakani Hospital, Nehru Street, Udumalaipettai, Tamil Nadu 642126")

    return Sivakani

    

def SNR(name):

    print("Dr."+name)

    print("\tAddress: SNR Eye Hospital,No:10, YRLayout, Udumalaipettai, Tamil Nadu 642126")

    print("\tPhone: 094863 55014")

    return SNR

    

def Srichakra(name):

    print("Dr."+name)

    print("\tAddress: Srichakra Hospital,No:4/147, Nehru Street, Udumalaipettai, Tamil Nadu 642126")

    print("\tPhone: 096262 00600")

    return Srichakra

    

def Senthil(name):

    print("Dr."+name)

    print("\tAddress: Senthil Kumar Paediatric Clinic,No:12, YRLayout, Udumalaipettai, Tamil Nadu 642126")

    print("\tPhone: 04252 230 403")

    return Senthil

    

def Lakshmi(name):

    print("Dr."+name)

    print("\tAddress: Lakshmi clinic,10.B, M.R.Lodge N Rd, Anusham Nagar, Udumalaipettai, Tamil Nadu 642126")

    return Lakshmi


print("\tList of the Hosiptal in Udumalpet")

print("\n\t1.Subam Clinic Medical Centre(Dr. Ravichandran)")

print("\t2.SK Medical Centre(Dr. Srinivas)")

print("\t3.Saravana Hospital(Dr. Nirmala balakumar)")

print("\t4.Sivakani Hospital(Dr. Sivakani)")

print("\t5.SNR Eye Hospital(Dr. Selvaraj R)")

print("\t6.Srichakra Hospital(Dr. Ashok M)")

print("\t7.Senthil Kumar Paediatric Clinic(Dr. Senthil Kumar)")

print("\t8.Lakshmi clinic(Dr. Lakshmi)")

B=1

while B<=5:

    a=str(input("\n\tEnter the Doctor name:"))

    if a=="Ravichandran":

        Subam=Subam("Ravichandran")

        B=B+1

    elif a=="Srinivas":

        sk=sk("Srinivas")

        B=B+1

    elif a=="Nirmala balakumar":

        Saravana=Saravana("Nirmala balakumar")

        B=B+1

    elif a=="Sivakani":

        Sivakani=Sivakani("Sivakani")

        B=B+1

    elif a=="Selvaraj R":

        SNR=SNR("Selvaraj R")

        B=B+1

    elif a=="Ashok M":

        Srichakra=Srichakra("Ashok M")

        B=B+1

    elif a=="Senthil Kumar":

        Senthil=Senthil("Senthil Kumar")

        B=B+1

    elif a=="Lakshmi":

        Lakshmi=Lakshmi("Lakshmi")

        B=B+1


output:

List of the Hosiptal in Udumalpet


        1.Subam Clinic Medical Centre(Dr. Ravichandran)

        2.SK Medical Centre(Dr. Srinivas)

        3.Saravana Hospital(Dr. Nirmala balakumar)

        4.Sivakani Hospital(Dr. Sivakani)

        5.SNR Eye Hospital(Dr. Selvaraj R)

        6.Srichakra Hospital(Dr. Ashok M)

        7.Senthil Kumar Paediatric Clinic(Dr. Senthil Kumar)

        8.Lakshmi clinic(Dr. Lakshmi)


        Enter the Doctor name:Ravichandran

Dr.Ravichandran

        Address: Subam Clinic Medical Centre, No: 2, Saravana Street, Udumalaipettai, Tamil Nadu 642126

        Phone: 04252 222 018


        Enter the Doctor name:Srinivas

Dr.Srinivas

        Address: SK Medical Centre, No:20, Saravana Street, Udumalaipettai, Tamil Nadu 642126

        Phone: 04252 232 233


Monday, August 16, 2021

Energia code for IoT gas detecting sensor using cc3200

 

#ifndef _CC3200R1M1RGC_

// Do not include SPI for CC3200 LaunchPad

#include <SPI.h>

#endif

#include <WiFi.h>

#include <Wire.h>

#include "Adafruit_TMP006.h"

#include <stdlib.h>

int offset =20;

int offset1 =20;

 

// ThingSpeak Settings

char thingSpeakAddress[] = "api.thingspeak.com";

String writeAPIKey = "*********************";

const int updateThingSpeakInterval = 16 * 1000; // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval)

const int ledPin = RED_LED;

const int ledPin1 = GREEN_LED;

const int ledPin2 = YELLOW_LED;

 

//buffer for float to string

char buffer[25];

// your network name also called SSID

char ssid[] = "*******";

// your network password

char password[] = "********";

 

// initialize the library instance:

WiFiClient client;

 

unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds

boolean lastConnected = false; // state of the connection last time through the main loop

const unsigned long postingInterval = 10*1000; //delay between updates to xively.com

int failedCounter = 0;

 

Adafruit_TMP006 tmp006(0x41); // start with a diferent i2c address!

void setup() {

//Initialize serial and wait for port to open:

pinMode(ledPin, OUTPUT);

pinMode(ledPin1, OUTPUT);

pinMode(ledPin2, OUTPUT);

Serial.begin(115200);

 

 

// attempt to connect to Wifi network:

Serial.print("Attempting to connect to Network named: ");

// print the network name (SSID);

Serial.println(ssid);

// Connect to WPA/WPA2 network. Change this line if using open or WEP network:

WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED) {

// print dots while we wait to connect

Serial.print(".");

delay(300);

}

 

if (! tmp006.begin()) {

Serial.println("No sensor found");

while (1);

}

 

Serial.println("\nYou're connected to the network");

Serial.println("Waiting for an ip address");

 

while (WiFi.localIP() == INADDR_NONE) {

// print dots while we wait for an ip addresss

Serial.print(".");

delay(300);

}

 

Serial.println("\nIP Address obtained");

printWifiStatus();

}

void loop() {

  float sensor;

  float sensor1;

  float sensor2;

  float sensor3;

  float sensor4;

   digitalWrite(ledPin2, LOW);

// if there's incoming data from the net connection.

// send it out the serial port. This is for debugging

// purposes only:

while (client.available()) {

char c = client.read();

Serial.print(c);

}

 

// if there's no net connection, but there was one last time

// through the loop, then stop the client:

if (!client.connected() && lastConnected) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

}

 

// if you're not connected, and ten seconds have passed since

// your last connection, then connect again and send data:

if (!client.connected() && (millis() - lastConnectionTime > postingInterval)) {

// read the temp sensor:

int sensor = analogRead(2);// read the input

 

  Serial.print("sensor: ");

  String ssensor = dtostrf(sensor,3,3,buffer);Serial.print(ssensor); Serial.println("sec");

 

 

 int sensor1 = analogRead(6);// read the input

 

  Serial.print("sensor1: ");

 String ssensor1 = dtostrf(sensor1,3,3,buffer);Serial.print(ssensor1); Serial.println("sec");

 

  int sensor2 = analogRead(23);// read the input

 

  Serial.print("sensor2: ");

 String ssensor2 = dtostrf(sensor2,3,3,buffer);Serial.print(ssensor2); Serial.println("sec");

 

   int sensor3 = analogRead(24);// read the input

 

  Serial.print("sensor3: ");

 String ssensor3 = dtostrf(sensor3,3,3,buffer);Serial.print(ssensor3); Serial.println("sec");

 

  int sensor4 = analogRead(25);// read the input

 

  Serial.print("sensor4: ");

 String ssensor4 = dtostrf(sensor4,3,3,buffer);Serial.print(ssensor4); Serial.println("sec");

 

 

//send to server

updateThingSpeak("field1=" + ssensor+ "&field2=" + ssensor1 + "&field3=" + ssensor2 + "&field4=" + ssensor3 + "&field5" + ssensor4);

}

// store the state of the connection for next time through

// the loop:

lastConnected = client.connected();

}

void updateThingSpeak(String tsData)

{

if (client.connect(thingSpeakAddress, 80))

{

client.print("POST /update HTTP/1.1\n");

client.print("Host: api.thingspeak.com\n");

client.print("Connection: close\n");

client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");

client.print("Content-Length: ");

client.print(tsData.length());

Serial.println(">>TSDATALength=" + tsData.length());

client.print("\n\n");

 

client.print(tsData);

Serial.println(">>TSDATA=" + tsData);

 

lastConnectionTime = millis();

 

if (client.connected())

{

Serial.println("Connecting to ThingSpeak...");

Serial.println();

 

failedCounter = 0;

}

else

{

failedCounter++;

 

Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");

Serial.println();

}

 

}

else

{

failedCounter++;

 

Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");

Serial.println();

 

lastConnectionTime = millis();

}

}

// This method calculates the number of digits in the

// sensor reading. Since each digit of the ASCII decimal

// representation is a byte, the number of digits equals

// the number of bytes:

 

int getLength(int someValue) {

// there's at least one byte:

int digits = 1;

// continually divide the value by ten,

// adding one to the digit count for each

// time you divide, until you're at 0:

int dividend = someValue / 10;

while (dividend > 0) {

dividend = dividend / 10;

digits++;

}

// return the number of digits:

return digits;

}

 

void printWifiStatus() {

// print the SSID of the network you're attached to:

Serial.print("SSID: ");

Serial.println(WiFi.SSID());

 

// print your WiFi shield's IP address:

IPAddress ip = WiFi.localIP();

Serial.print("IP Address: ");

Serial.println(ip);

 

// print the received signal strength:

long rssi = WiFi.RSSI();

Serial.print("signal strength (RSSI):");

Serial.print(rssi);

Serial.println(" dBm");

}

Energia code for IoT gas detecting sensor using cc3200

 

#ifndef _CC3200R1M1RGC_

// Do not include SPI for CC3200 LaunchPad

#include <SPI.h>

#endif

#include <WiFi.h>

#include <Wire.h>

#include "Adafruit_TMP006.h"

#include <stdlib.h>

int offset =20;

int offset1 =20;

 

int sensorValue = 0;

// ThingSpeak Settings

char thingSpeakAddress[] = "api.thingspeak.com";

String writeAPIKey = "DDVEZNUINIL61P6N";

const int updateThingSpeakInterval = 16 * 1000; // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval)

 

//buffer for float to string

char buffer[25];

// your network name also called SSID

char ssid[] = "******";

// your network password

char password[] = "*******";

 

// initialize the library instance:

WiFiClient client;

 

unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds

boolean lastConnected = false; // state of the connection last time through the main loop

const unsigned long postingInterval = 10*1000; //delay between updates to xively.com

int failedCounter = 0;

 

Adafruit_TMP006 tmp006(0x41); // start with a diferent i2c address!

 

void setup() {

//Initialize serial and wait for port to open:

pinMode (29, OUTPUT);

pinMode (10, OUTPUT);

pinMode (9, OUTPUT);

Serial.begin(115200);

digitalWrite(29,LOW);

digitalWrite(10,LOW);

digitalWrite(9,LOW);

 

// attempt to connect to Wifi network:

Serial.print("Attempting to connect to Network named: ");

// print the network name (SSID);

Serial.println(ssid);

// Connect to WPA/WPA2 network. Change this line if using open or WEP network:

WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED) {

// print dots while we wait to connect

Serial.print(".");

delay(300);

}

 

if (! tmp006.begin()) { 

Serial.println("No sensor found");

while (1);

}

 

Serial.println("\nYou're connected to the network");

Serial.println("Waiting for an ip address");

 

while (WiFi.localIP() == INADDR_NONE) {

// print dots while we wait for an ip addresss

Serial.print(".");

delay(300);

}

 

Serial.println("\nIP Address obtained");

printWifiStatus();

}

void loop() {

 

 

 

 

// if there's incoming data from the net connection.

// send it out the serial port. This is for debugging

// purposes only:

while (client.available()) {

char c = client.read();

Serial.print(c);

}

 

// if there's no net connection, but there was one last time

// through the loop, then stop the client:

if (!client.connected() && lastConnected) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

}

 

// if you're not connected, and ten seconds have passed since

// your last connection, then connect again and send data:

if (!client.connected() && (millis() - lastConnectionTime > postingInterval)) {

// read the temp sensor:

 

int sensorValue   = analogRead(2);

int sensorValue1  = analogRead(6);

int sensorValue2  = analogRead(23);

int sensorValue3  = analogRead(24);

 

  // MQ2 GAS SENSOR

   Serial.print("gasSensor: ");

   String ssensorValue = dtostrf(sensorValue,3,3,buffer);Serial.print(ssensorValue); Serial.println("count");

   delay(500);

   if (sensorValue > 2440) {

     digitalWrite(29,HIGH);

     delay(1000);

   }

   else {

     digitalWrite(29,LOW);

   }

   // MQ135 GAS SENSOR

   Serial.print("gasSensor1: ");

   String ssensorValue1 = dtostrf(sensorValue1,3,3,buffer);Serial.print(ssensorValue1); Serial.println("ppm");

   delay(500);

   if (sensorValue1 > 1870) {

     digitalWrite(9,HIGH);

     delay(500);

   }

   else {

     digitalWrite(9,LOW);

   }

   // MQ6 GAS SENSOR

   Serial.print("volt: ");

   float volt = sensorValue2/1024*5.0;

   String svolt = dtostrf(volt,3,3,buffer);Serial.print(svolt); Serial.println("V");

   delay(500);

   if (volt > 15) {

     digitalWrite(10,HIGH);

   }

   else {

     digitalWrite(10,LOW);

   }

  

   // MQ7 GAS SENSOR

   Serial.print("volt1: ");

   float volt1 = sensorValue3/1024*5.0;

   String svolt1 = dtostrf(volt1,3,3,buffer);Serial.print(svolt1); Serial.println("v");

   delay(500);

    if (volt1 <= 10) {

     digitalWrite(10,HIGH);

   }

   else {

     digitalWrite(10,LOW);

   }

  

  

//send to server

updateThingSpeak("field1=" + ssensorValue + "&field2=" + ssensorValue1 + "&field3=" + svolt + "&field4=" + svolt1 );

 

 

}

// store the state of the connection for next time through

// the loop:

lastConnected = client.connected();

}

void updateThingSpeak(String tsData)

{

if (client.connect(thingSpeakAddress, 80))

{

client.print("POST /update HTTP/1.1\n");

client.print("Host: api.thingspeak.com\n");

client.print("Connection: close\n");

client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");

client.print("Content-Length: ");

 

 

client.print(tsData.length());

Serial.println(">>TSDATALength=" + tsData.length());

client.print("\n\n");

 

client.print(tsData);

Serial.println(">>TSDATA=" + tsData);

 

lastConnectionTime = millis();

 

if (client.connected())

{

Serial.println("Connecting to ThingSpeak...");

Serial.println();

 

failedCounter = 0;

}

else

{

failedCounter++;

 

Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");

Serial.println();

}

 

}

else

{

failedCounter++;

 

Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");

Serial.println();

 

lastConnectionTime = millis();

}

}

// This method calculates the number of digits in the

// sensor reading. Since each digit of the ASCII decimal

// representation is a byte, the number of digits equals

// the number of bytes:

 

int getLength(int someValue) {

// there's at least one byte:

int digits = 1;

// continually divide the value by ten,

// adding one to the digit count for each

// time you divide, until you're at 0:

int dividend = someValue / 10;

while (dividend > 0) {

dividend = dividend / 10;

digits++;

}

// return the number of digits:

return digits;

}

 

void printWifiStatus() {

// print the SSID of the network you're attached to:

Serial.print("SSID: ");

Serial.println(WiFi.SSID());

 

// print your WiFi shield's IP address:

IPAddress ip = WiFi.localIP();

Serial.print("IP Address: ");

Serial.println(ip);

 

// print the received signal strength:

long rssi = WiFi.RSSI();

Serial.print("signal strength (RSSI):");

Serial.print(rssi);

Serial.println(" dBm");

}

Energia code for IoT prepaid electricity using cc3200

//Measuring Current Using ACS712

 

//const int analogchannel = 0; //Connect current sensor with A0 of Arduino

int sensitivity = 185; // use 100 for 20A Module and 66 for 30A Module

int adcvalue= 0;

int offsetvoltage = 2500; 

double Voltage = 0; //voltage measuring

double ecurrent = 0;// Current measuring

int adcvalue1= 0;

//int offsetvoltage = 2500; 

double Voltage1 = 0; //voltage measuring

double ecurrent1 = 0;// Current measuring

float Rate=0;

float Rate1=0;

float current=0;

#ifndef __CC3200R1M1RGC__

// Do not include SPI for CC3200 LaunchPad

#include <SPI.h>

#endif

#include <WiFi.h>

#include <Wire.h>

#include "Adafruit_TMP006.h"

#include <stdlib.h>


// ThingSpeak Settings

char thingSpeakAddress[] = "api.thingspeak.com";

String writeAPIKey = "7X*********GH";

const int updateThingSpeakInterval = 16 * 1000; // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval)


//buffer for float to string

char buffer[25];

// your network name also called SSID

char ssid[] = "*******";

// your network password

char password[] = "*********";


// initialize the library instance:

WiFiClient client;


unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds

boolean lastConnected = false; // state of the connection last time through the main loop

const unsigned long postingInterval = 10*1000; //delay between updates to xively.com

int failedCounter = 0;


Adafruit_TMP006 tmp006(0x41); // start with a diferent i2c address!

void setup() {

//Initialize serial and wait for port to open:

Serial.begin(115200);


// attempt to connect to Wifi network:

Serial.print("Attempting to connect to Network named: ");

// print the network name (SSID);

Serial.println(ssid);

// Connect to WPA/WPA2 network. Change this line if using open or WEP network:

WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED) {

// print dots while we wait to connect

Serial.print(".");

delay(300);

}


if (! tmp006.begin()) {

Serial.println("No sensor found");

while (1);

}


Serial.println("\nYou're connected to the network");

Serial.println("Waiting for an ip address");


while (WiFi.localIP() == INADDR_NONE) {

// print dots while we wait for an ip addresss

Serial.print(".");

delay(300);

}


Serial.println("\nIP Address obtained");

printWifiStatus();

}

void loop() {

// if there's incoming data from the net connection.

// send it out the serial port. This is for debugging

// purposes only:

  // put your main code here, to run repeatedly:

adcvalue = analogRead(2);//reading the value from the analog pin

adcvalue1=(adcvalue/3);

Voltage = (adcvalue1/ 1024.0) * 5000; // Gets you mV

 ecurrent = ((Voltage - offsetvoltage) / sensitivity);

 current=(ecurrent/2.6);

 

     

   Serial.print("Raw Value = " ); // prints on the serial monitor

 Serial.print(adcvalue1); //prints the results on the serial monitor  

 Serial.print("\t Voltage(mV) = ");

 Serial.print(Voltage);

 Serial.print("\t Current = ");

 Serial.println(current);

 delay(2000);

 String scurrent = dtostrf(current,3,3,buffer);

 delay(2500); //delay of 2.5 sec

 while (client.available()) {

char c = client.read();

Serial.print(c);

}


// if there's no net connection, but there was one last time

// through the loop, then stop the client:

if (!client.connected() && lastConnected) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

}


// if you're not connected, and ten seconds have passed since

// your last connection, then connect again and send data:

if (!client.connected() && (millis() - lastConnectionTime > postingInterval)) {

// read the temp sensor:


updateThingSpeak("field1=" + scurrent1);}

// store the state of the connection for next time through

// the loop:

lastConnected = client.connected();

}

void updateThingSpeak(String tsData)

{

if (client.connect(thingSpeakAddress, 80))

{

client.print("POST /update HTTP/1.1\n");

client.print("Host: api.thingspeak.com\n");

client.print("Connection: close\n");

client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");

client.print("Content-Length: ");

client.print(tsData.length());

Serial.println(">>TSDATALength=" + tsData.length());

client.print("\n\n");


client.print(tsData);

Serial.println(">>TSDATA=" + tsData);


lastConnectionTime = millis();


if (client.connected())

{

Serial.println("Connecting to ThingSpeak...");

Serial.println();


failedCounter = 0;

}

else

{

failedCounter++;


Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");

Serial.println();

}


}

else

{

failedCounter++;


Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");

Serial.println();


lastConnectionTime = millis();

}

}

// This method calculates the number of digits in the

// sensor reading. Since each digit of the ASCII decimal

// representation is a byte, the number of digits equals

// the number of bytes:


int getLength(int someValue) {

// there's at least one byte:

int digits = 1;

// continually divide the value by ten,

// adding one to the digit count for each

// time you divide, until you're at 0:

int dividend = someValue / 10;

while (dividend > 0) {

dividend = dividend / 10;

digits++;

}

// return the number of digits:

return digits;

}


void printWifiStatus() {

// print the SSID of the network you're attached to:

Serial.print("SSID: ");

Serial.println(WiFi.SSID());


// print your WiFi shield's IP address:

IPAddress ip = WiFi.localIP();

Serial.print("IP Address: ");

Serial.println(ip);


// print the received signal strength:

long rssi = WiFi.RSSI();

Serial.print("signal strength (RSSI):");

Serial.print(rssi);

Serial.println(" dBm");

}


Energia code for gift pack size wise alert using cc3200

 const int startingpoint = 2;

const int endpoint = 40;


int smallbagCounter = 0;

int mediumbagCounter = 0; 

int largebagCounter = 0;   

int bagState = 0;   

int lastbagState = 0;




void setup() {

  // put your setup code here, to run once:

  for(int bag=startingpoint ; bag<=endpoint ; bag++) {

    pinMode(bag,OUTPUT);


  }

  

    

    pinMode(9,OUTPUT);

    pinMode(10,OUTPUT);

    pinMode(29,OUTPUT);

    Serial.begin(115200);


}


void loop() {

  


  // put your main code here, to run repeatedly: 

  



  

  for(int bag=startingpoint ; bag<=endpoint ; bag++) {

    for( int speed = 0 ; speed < 255 ; speed ++){

      analogWrite(bag , speed );

      delay(3);

    }


   for (int speed = 255; speed >= 0; speed--) {

    analogWrite(bag, speed);

    delay(3);

    

   }

    bagState = digitalRead(bag);

    

    switch(bag){

    case 9 :

    Serial.println("small size Gift");

    digitalWrite(9,HIGH);

    smallbagCounter++;

    Serial.print("no of small bags");

    Serial.println(smallbagCounter);

    break;

 

    case 10 :

    Serial.println("medium size Gift");

    digitalWrite(10,HIGH);

    mediumbagCounter++;

    Serial.print("no of large bags");

    Serial.println(largebagCounter);

    break;

    

  

    case 29 :

    Serial.println("large size Gift");

    digitalWrite(29,HIGH);

    largebagCounter++;

    Serial.print("no of large bags");

    Serial.println(largebagCounter);

    break;

    }


 

   delay(5);

  } 



}


Energia code for IoT Hygiene monitoring system in vechicle using cc3200

 #ifndef CC3200R1M1RGC

#include <SPI.h>

#endif

#include <WiFi.h>

#include <Wire.h>

#include <stdlib.h>



int MQ2 = 2;

int MQ6 = 6;


int MQ135 =24;

int dust =23;





// ThingSpeak Settings

char thingSpeakAddress[] = "api.thingspeak.com";

String writeAPIKey = "****";

const int updateThingSpeakInterval = 16 * 1000; // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval)


//buffer for float to string

char buffer[25];

// your network name also called SSID

char ssid[] = "***";

// your network password

char password[] = "****";


// initialize the library instance:

WiFiClient client;


unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds

boolean lastConnected = false; // state of the connection last time through the main loop

const unsigned long postingInterval = 10*1000; //delay between updates to xively.com

int failedCounter = 0;


void setup() {

  // put your setup code here, to run once:

  pinMode(2, INPUT);

  pinMode(6, INPUT);


  pinMode(24, INPUT);

  pinMode(23, INPUT);

  Serial.begin(115200);


  // attempt to connect to Wifi network:

Serial.print("Attempting to connect to Network named: ");

// print the network name (SSID);

Serial.println(ssid);

// Connect to WPA/WPA2 network. Change this line if using open or WEP network:

WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED) {

// print dots while we wait to connect

Serial.print(".");

delay(300);

}

Serial.println("\nYou're connected to the network");

Serial.println("Waiting for an ip address");


while (WiFi.localIP() == INADDR_NONE) {

// print dots while we wait for an ip addresss

Serial.print(".");

delay(300);

}


Serial.println("\nIP Address obtained");

printWifiStatus();

}


void loop() {

  // put your main code here, to run repeatedly: 

  float alert_MQ2_value , alert_MQ6_value , alert_MQ135_value ,salert_MQ135, alert_dust_value;


while (client.available()) {

char c = client.read();

Serial.print(c);

}


// if there's no net connection, but there was one last time

// through the loop, then stop the client:

if (!client.connected() && lastConnected) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

}


// if you're not connected, and ten seconds have passed since

// your last connection, then connect again and send data:

if (!client.connected() && (millis() - lastConnectionTime > postingInterval)) {

  float MQ2_value = analogRead(MQ2);

  float MQ6_value = analogRead(MQ6);

  

  float MQ135_value = analogRead(MQ135);

  float dust_value = analogRead(dust);

 

if(MQ2_value >  400){

  alert_MQ2_value = MQ2_value;

}

else{

  alert_MQ2_value = 0;

}

Serial.print("Smoke range : ");

String sMQ2_value = dtostrf(alert_MQ2_value,3,3,buffer);

Serial.println(sMQ2_value);


if(MQ6_value > 400){

  alert_MQ6_value = MQ6_value;

}

else{

  alert_MQ6_value =0;

}

Serial.print("LPG Gas range : ");

String sMQ6_value = dtostrf(alert_MQ6_value,3,3,buffer);

Serial.println(sMQ6_value);


if(MQ135 > 400){

  float salert_MQ135 =  (alert_MQ135_value/1023*100);

}

else{

  salert_MQ135 =0;

}


Serial.print("Gas Level : ");

Serial.println(salert_MQ135);


if(dust_value> 400){

 float v = alert_dust_value * (5  / 1024);

 dust = (0.17 * v - 0.1);

}

else{

  dust =0;

}


Serial.print("Dust density : ");

Serial.println(dust);






//send to server

updateThingSpeak("field1=" + sMQ2_value + "&field2=" + sMQ6_value + "&field3=" +salert_MQ135 + "&field4=" +dust);

}

// store the state of the connection for next time through

// the loop:

lastConnected = client.connected();

}

void updateThingSpeak(String tsData)

{

if (client.connect(thingSpeakAddress, 80))

{

client.print("POST /update HTTP/1.1\n");

client.print("Host: api.thingspeak.com\n");

client.print("Connection: close\n");

client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");

client.print("Content-Length: ");

client.print(tsData.length());

Serial.println(">>TSDATALength=" + tsData.length());

client.print("\n\n");


client.print(tsData);

Serial.println(">>TSDATA=" + tsData);


lastConnectionTime = millis();


if (client.connected())

{

Serial.println("Connecting to ThingSpeak...");

Serial.println();


failedCounter = 0;

}

else

{

failedCounter++;


Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");

Serial.println();

}


}

else

{

failedCounter++;


Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");

Serial.println();


lastConnectionTime = millis();

}

}

// This method calculates the number of digits in the

// sensor reading. Since each digit of the ASCII decimal

// representation is a byte, the number of digits equals

// the number of bytes:


int getLength(int someValue) {

// there's at least one byte:

int digits = 1;

// continually divide the value by ten,

// adding one to the digit count for each

// time you divide, until you're at 0:

int dividend = someValue / 10;

while (dividend > 0) {

dividend = dividend / 10;

digits++;

}

// return the number of digits:

return digits;

}


void printWifiStatus() {

// print the SSID of the network you're attached to:

Serial.print("SSID: ");

Serial.println(WiFi.SSID());


// print your WiFi shield's IP address:

IPAddress ip = WiFi.localIP();

Serial.print("IP Address: ");

Serial.println(ip);


// print the received signal strength:

long rssi = WiFi.RSSI();

Serial.print("signal strength (RSSI):");

Serial.print(rssi);

Serial.println(" dBm");

}


Friday, August 13, 2021

Energia code for Calories gain or loss task using cc3200

 const int Steps = PUSH2;

const int led1 = RED_LED;



int StepsCounter=0; 

int StepsState = 0;

int LastStepsState=0;


void setup() {

  // put your setup code here, to run once:

  pinMode(Steps,INPUT_PULLUP);

  pinMode(led1,OUTPUT);


  Serial.begin(115200);


}


void loop() {

  

  // put your main code here, to run repeatedly: 


  StepsState = digitalRead(Steps);

  

  if (StepsState != LastStepsState) {

    if (StepsState == HIGH) {

      StepsCounter++;

      Serial.println ("person detected");

      Serial.print("number of steps = ");

      Serial.print(StepsCounter);

    }

  }

    else {

      Serial.print("person not detected");

    }

  

   StepsState = LastStepsState;

  

  if (StepsCounter % 4 == 0) {

    Serial.print("4kg calories decrese");

    digitalWrite(led1 , HIGH);

  }

  else{

    digitalWrite(led1 , LOW);

    

  }

  }

 


Energia code for IoT Based election result announced using cc3200

 #ifndef _CC3200R1M1RGC_

// Do not include SPI for CC3200 LaunchPad

#include <SPI.h>

#endif

#include <WiFi.h>

#include <Wire.h>

#include <stdlib.h>


const int buttonpin1 = PUSH1;

const int buttonpin2 = PUSH2;

const int green = GREEN_LED;

const int red = RED_LED;

const int yellow =YELLOW_LED;


int buttonpushCounter =0;

int buttonstate1 =0;

int lastbuttonstate1 = 0;

int buttonstate2 =0;

int lastbuttonstate2 = 0;



// ThingSpeak Settings

char thingSpeakAddress[] = "api.thingspeak.com";

String writeAPIKey = "E4***********UB";

const int updateThingSpeakInterval = 16 * 1000; // Time interval in milliseconds to update ThingSpeak (number of seconds * 1000 = interval)


//buffer for float to string

char buffer[25];

// your network name also called SSID

char ssid[] = "*****";

// your network password

char password[] = "*********";


// initialize the library instance:

WiFiClient client;


unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds

boolean lastConnected = false; // state of the connection last time through the main loop

const unsigned long postingInterval = 10*1000; //delay between updates to xively.com

int failedCounter = 0;

 // start with a diferent i2c address!

void setup() {

//Initialize serial and wait for port to open:

pinMode (PUSH1 , INPUT_PULLUP);

pinMode (PUSH2 , INPUT_PULLUP);

pinMode (green , OUTPUT);

pinMode (red , OUTPUT);

pinMode (yellow , OUTPUT);


Serial.begin(115200);


// attempt to connect to Wifi network:

Serial.print("Attempting to connect to Network named: ");

// print the network name (SSID);

Serial.println(ssid);

// Connect to WPA/WPA2 network. Change this line if using open or WEP network:

WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED) {

// print dots while we wait to connect

Serial.print(".");

delay(300);

}



Serial.println("\nYou're connected to the network");

Serial.println("Waiting for an ip address");


while (WiFi.localIP() == INADDR_NONE) {

// print dots while we wait for an ip addresss

Serial.print(".");

delay(300);

}


Serial.println("\nIP Address obtained");

printWifiStatus();

}void loop() {

// if there's incoming data from the net connection.

// send it out the serial port. This is for debugging

// purposes only:

while (client.available()) {

char c = client.read();

Serial.print(c);

}


// if there's no net connection, but there was one last time

// through the loop, then stop the client:

if (!client.connected() && lastConnected) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

}


// if you're not connected, and ten seconds have passed since

// your last connection, then connect again and send data:

if (!client.connected() && (millis() - lastConnectionTime > postingInterval)) {


  buttonstate1 = digitalRead(PUSH1);

  buttonstate2 = digitalRead(PUSH2);


  if(buttonstate1 != lastbuttonstate1){

  if(buttonstate1 == HIGH);

  buttonpushCounter++;

 } 


 if(buttonstate2 != lastbuttonstate2){

 if(buttonstate2 == HIGH);

 buttonpushCounter++;

 } 


if (buttonpushCounter <=10) {

  Serial.print("Count no ");

  Serial.print(buttonpushCounter1);

  delay(1000);

}

if (buttonpushCounter == 1){

  digitalWrite(green, LOW);

  digitalWrite(red , LOW);

  digitalWrite(yellow , HIGH);

}

if (buttonpushCounter % 2 == 0){

  digitalWrite(green, HIGH);

  digitalWrite(red , LOW);

  digitalWrite(yellow , LOW);

}



if (buttonpushCounter == 10){

  Serial.print("completed");

  digitalWrite(red,HIGH);

  digitalWrite(green,LOW);

  digitalWrite(yellow,LOW);


}

//send to server

updateThingSpeak("field1=" + buttonpushCounter1 );

}

// store the state of the connection for next time through

// the loop:

lastConnected = client.connected();

}

void updateThingSpeak(String tsData)

{

if (client.connect(thingSpeakAddress, 80))

{

client.print("POST /update HTTP/1.1\n");

client.print("Host: api.thingspeak.com\n");

client.print("Connection: close\n");

client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");

client.print("Content-Length: ");

client.print(tsData.length());

Serial.println(">>TSDATALength=" + tsData.length());

client.print("\n\n");


client.print(tsData);

Serial.println(">>TSDATA=" + tsData);


lastConnectionTime = millis();


if (client.connected())

{

Serial.println("Connecting to ThingSpeak...");

Serial.println();


failedCounter = 0;

}

else

{

failedCounter++;


Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");

Serial.println();

}


}

else

{

failedCounter++;


Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");

Serial.println();


lastConnectionTime = millis();

}

}

// This method calculates the number of digits in the

// sensor reading. Since each digit of the ASCII decimal

// representation is a byte, the number of digits equals

// the number of bytes:


int getLength(int someValue) {

// there's at least one byte:

int digits = 1;

// continually divide the value by ten,

// adding one to the digit count for each

// time you divide, until you're at 0:

int dividend = someValue / 10;

while (dividend > 0) {

dividend = dividend / 10;

digits++;

}

// return the number of digits:

return digits;

}


void printWifiStatus() {

// print the SSID of the network you're attached to:

Serial.print("SSID: ");

Serial.println(WiFi.SSID());


// print your WiFi shield's IP address:

IPAddress ip = WiFi.localIP();

Serial.print("IP Address: ");

Serial.println(ip);


// print the received signal strength:

long rssi = WiFi.RSSI();

Serial.print("signal strength (RSSI):");

Serial.print(rssi);

Serial.println(" dBm");

}


 


 


USD TO INR C++ PROGRAMMING

  NALLAMUTHU GOUNDER MAHALINGAM COLLEGE                                                 POLLACHI-642001                                     ...