Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Wuz Goood Okay I need Help pls I am trying to send data to Twilio Protocaol to get SMS to my number using arduino esp32

Wuz Goood

Okay I need Help pls

I am trying to send data to Twilio Protocaol to get SMS to my number using arduino esp32

this is the code

I have higlighted the placese where I have stucked

#include "twilio.hpp"

#include

#include

#include "Messenger.h"

#define Messenger_H_

#include "twilio.hpp"

Messenger *messenger;

#define SENSOR_PIN 21 // ESP32 pin GIOP21 connected to DS18B20 sensor's DQ pin

OneWire oneWire(SENSOR_PIN);

DallasTemperature DS18B20(&oneWire);

// Set these - but DON'T push them to GitHub!

static const char *ssid = "World";

static const char *password = "11223344";

// Values from Twilio (find them on the dashboard)

static const char *account_sid = "AC5f8de1604b39520a3a1d4f1eaf3f3f92";

static const char *auth_token = "c25c907a34f31db2815347ceac62e78d";

// Phone number should start with "+"

static const char *from_number = "+18507861811";

// You choose!

// Phone number should start with "+"

static const char *to_number = "+601111377299";

static const char *message ="Temp is:"+ DS18B20.getTempCByIndex ;

Twilio *twilio;

float tempC; // temperature in Celsius

float tempF; // temperature in Fahrenheit

void setup() {

Serial.begin(115200); // initialize serial

DS18B20.begin(); // initialize the DS18B20 sensor

Serial.print("Connecting to WiFi network ;");

Serial.print(ssid);

Serial.println("'...");

WiFi.begin(ssid, password);

initMessenger();

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

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

delay(500);

}

Serial.println("Connected!");

twilio = new Twilio(account_sid, auth_token);

delay(1000);

String response;

bool success = twilio->send_message(to_number, from_number, message, response);

if (success) {

Serial.println("Sent message successfully!");

} else {

Serial.println(response);

}

}

void loop() {

DS18B20.requestTemperatures(); // send the command to get temperatures

tempC = DS18B20.getTempCByIndex(0); // read temperature in C

tempF = tempC * 9 / 5 + 32; // convert C to F

String msgBody = "";

if (tempC >28 || tempC <18){

msgBody += "Temperature: ";

msgBody += String(tempC, 1) +"'C ";

msgBody += "From the House>Room 1";

messenger->sendMessage(msgBody);

}

Serial.print("Temperature: ");

Serial.print(tempC); // print the temperature in C

Serial.print("C");

Serial.print(" ~ "); // separator between C and F

Serial.print(tempF); // print the temperature in F

Serial.println("F");

delay(500);

}

void initMessenger(){

messenger = new Messenger();

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 Tsukuba Japan April 2010 Proceedings Part 1 Lncs 5981

Authors: Hiroyuki Kitagawa ,Yoshiharu Ishikawa ,Wenjie Li ,Chiemi Watanabe

2010th Edition

3642120253, 978-3642120251

More Books

Students also viewed these Databases questions