
Intel Edison – , , , , . – , Arduino. ++, Intel Edison – , (sketch) Arduino. , Intel Edison . . Intel Edison , , .
Twilio SMS MMS- Twilio, , , . SMS MMS- , REST API Twilio, SMS- SMS- . SMS- Twilio.
, SMS- , Twilio.
, SMS-, :
- Intel Edison
- Arduino
- Grove – Starter Kit Plus
- Micro USB-
, Intel Edison,
.
Intel Edison Board Software Downloads , , , IDE Arduino.
Twilio
Twilio C++ Arduino IDE, C:\Arduino\arduino-1.5.3-Intel.1.0.4\libraries. Arduino , «–», twilio-cplusplus Twilio.
TwilioTwilio Example.cpp Example.cpp.org, Example.cpp , Twilio. Utils.h :
Utils.h#include <string.h>
#include <vector>
using namespace std;
USB Mass Storage Intel Edison
Multifunction Composite Gadget (g_multi) – , composite framework . , USB- USB Mass Storage, – Ethernet (RNDIS () CDC Ethernet) (ACM).
, modprobe. g_multi , USB Mass Storage Intel Edison.
modprobe, Edison.
, Edisonlosetup , «update» loopback (/dev/loop0) 8192. , , loopback /mnt/transfer.
EdisonUSB Mass Storage
, USB Mass Storage Windows.
USB Mass Storageg_multi.

Curl
« USB Mass Storage Intel Edison» , libcurl /usr/lib Edison Arduino IDE, hardware\tools\edison\sysroots\core2-32-poky-linux\usr\lib:
- libcurl.so
- libtasn1.so.6
- libgcrypt.so.11
- libgnutls.so.26
- libgpg-error.so.0
Curl Edison
Curl Windows, « USB Mass Storage Intel Edison» , /lib Edison Arduino IDE, hardware\tools\edison\sysroots\core2-32-poky-linux\lib:
- libz.so.1
- libcap.so.2
- libcrypto.so
Edison
WindowsCurl
Curl Arduino IDE hardware\tools\edison\sysroots\core2-32-poky-linux\usr\include:
CurlOpenSSL Arduino IDE hardware\tools\edison\sysroots\core2-32-poky-linux\usr\include:
OpenSSLArduino IDE, hardware\arduino\edison, platform.*.txt. , , . Arduino IDE Microsoft Windows, platform.win.txt.
platform.win.txt Windows, libcurl libcrypto , –lcurl –lcrypto «recipe.c.combine.pattern». .
– platform.win.txt.recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -march={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm -lpthread -lcurl –lcrypto
Twilio
SMS MMS- Twilio, SMS. ,
Twilio. , Hide API Credentials Twilio Account SID Auth Token:
Twilio
const char API_VERSION[] = "2010-04-01";
const char CALLER_ID[] = "1480405xxxx";
const char ACCOUNT_SID[] = "AC9c55339a5a070ae81e782117xxxxxxxx";
const char ACCOUNT_TOKEN[] = "59e8819f3f5b530b97b84baexxxxxxxx";
POST- Twilio
SMS-, POST- Twilio, URL «/SMS/Messages». «To», «From» «Body». «To» — , , SMS. «From» — Twilio, «Body» — SMS-.
SMS Twilio
char postReqStr[150];
strcpy(postReqStr, twilioAcc);
strcat(postReqStr, "/SMS/Messages");
Serial.println(postReqStr);
vars.clear();
vars.push_back(Var("To", "480-xxx-xxxx"));
vars.push_back(Var("From", "480-405-xxxx"));
vars.push_back(Var("Body", smsStr));
string response = twilioRest.request(postReqStr, "POST", vars);
, SMS-, . , .
. .
const int tempSensorPin = 1;
float degF = 0;
float getTemperature()
{
int analogValue = analogRead(tempSensorPin);
float resistance = (float)(1023 - analogValue) * 10000/analogValue;
float degKelvin = 1/(log(resistance/10000)/B_THERMISTOR + 1/298.15);
float degC = degKelvin - 273.15;
degF = (degC * 9.0) / 5.0 + 32.0;
return degF;
}
SMS- , 100 . Galileo Arduino IDE.
SMS Twilio#include "WString.h"
#include <Utils.h>
#include <Rest.h>
#include <TwiML.h>
#include <vector>
#include <math.h>
using namespace twilio;
vector<Var> vars;
const char API_VERSION[] = "2010-04-01";
const char CALLER_ID[] = "1480405xxxx";
const char ACCOUNT_SID[] = " AC9c55339a5a070ae81e782117xxxxxxxx ";
const char ACCOUNT_TOKEN[] = "59e8819f3f5b530b97b84baexxxxxxxx ";
const char* responseStr;
const int THRESHOLD_TEMP = 100;
const int WAIT = 1000000;
const int B_THERMISTOR = 3975;
int analogValue = 0;
float degKelvin = 0;
float degC = 0;
float degF = 0;
float resistance = 0;
const int tempSensorPin = 1;
void setup() {
Serial.begin(9600);
}
void sendSMS( float tempF ) {
char degFstr[20];
sprintf(degFstr, "%2f", degF);
char thresholdStr[20];
sprintf(thresholdStr, "%d", THRESHOLD_TEMP);
char smsStr[100] = "Current temperature is ";
strcat(smsStr, degFstr);
strcat(smsStr, " F greater than threshold temp ");
strcat(smsStr, thresholdStr);
strcat(smsStr, " F.");
char twilioAcc[70] = "/";
strcat(twilioAcc, API_VERSION);
strcat(twilioAcc, "/Accounts/");
strcat(twilioAcc, ACCOUNT_SID);
char postReqStr[150];
strcpy(postReqStr, twilioAcc);
strcat(postReqStr, "/SMS/Messages");
Serial.println(postReqStr);
Rest rest(ACCOUNT_SID, ACCOUNT_TOKEN);
vars.clear();
vars.push_back(Var("To", "480-xxx-xxxx"));
vars.push_back(Var("From", "480-405-xxxx"));
vars.push_back(Var("Body", smsStr));
string response = twilioRest.request(postReqStr, "POST", vars);
}
float getTemperature()
{
analogValue = analogRead(tempSensorPin);
resistance = (float)(1023 - analogValue) * 10000/analogValue;
degKelvin = 1/(log(resistance/10000)/B_THERMISTOR + 1/298.15);
degC = degKelvin - 273.15;
degF = (degC * 9.0) / 5.0 + 32.0;
return degF;
}
void loop() {
degF = getTemperature();
if(degF > THRESHOLD_TEMP)
{
sendSMS(degF);
delay(WAIT);
}
}
SMS- Twilio. Grove Starter Kit Plus – , –
. , Intel Edison.
software.intel.com/en-us/iot/hardware/edison/downloadswww-ssl.intel.com/content/www/us/en/do-it-yourself/edison.htmlsoftware.intel.com/en-us/iot/hardware/edisonsoftware.intel.com/en-us/iot/library/edison-getting-startedsoftware.intel.com/en-us/iot/hardware/devkitwww.seeedstudio.com/wiki/images/a/a1/NCP18WF104F03RC.pdf