Things used in this project

Code

file_9257.jsJavaScript
// your Twilio AccountSid and AuthToken
var account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
var auth_token = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";
var twilio_num = "5558675309";
var number = "55555555555"; // The number you want to text the information to
var client = require('twilio')(account_sid, auth_token);
file_9258.txtSH
npm install twilio
file_9259.jsJavaScript
sendText( number, twilio_num, "This text message was sent by Tessel. Cool, right?!");
function sendText(to,from,msg) {
  client.sms.messages.create({
    to: to,
    from: from,
    body:msg
  }, function(error, message) {
    if (!error) {
      console.log('Success! The SID for this SMS message is:');
      console.log(message.sid);
      console.log('Message sent on:');
      console.log(message.dateCreated);
    } else {
      console.log('Oops! There was an error.', error);
    }
  });
}
file_9260.txtSH
tessel run twilio.js
file_9261.txtSH
npm install accel-mma84
file_9262.jsJavaScript
var accel = require('accel-mma84').use(tessel.port['A']);
file_9263.jsJavaScript
// Initialize the accelerometer
accel.on('ready', function () {
  // Stream accelerometer data
  accel.on('data', function (xyz) {
    console.log( xyz );
  });
});

accel.on('error', function(err){
  console.log('Error:', err);
});
file_9264.jsJavaScript
var last_movement = 0.0;
var last_movement_time = Date.now();
file_9265.jsJavaScript
// Initialize the accelerometer
accel.on('ready', function () {
  // Stream accelerometer data
  accel.setOutputRate(1.56, function rateSet() {
    accel.setScaleRange( 8, function scaleSet() {
      accel.on('data', function (xyz) {
        if( last_movement !== xyz[0].toFixed(1) ) {
          last_movement = xyz[0].toFixed(1);
          var minutes = ( (Date.now() -  last_movement_time)/1000) / 60 ;
          last_movement_time = Date.now();
          if( minutes > 5 ) {
            // send text
            sendText(number, twilio_num, "Your dog slept for " + Math.round( minutes ) + " minutes");
          }
        }
      });
    });
  });
});
file_9266.txtSH
tessel run twilio.js
file_9267.txtSH
tessel push twilio.js
Gist

Credits

@rickyrobinett

Are you @rickyrobinett? Claim this project and add it to your profile.

This is mine
Posted by Fouu3goh51as9ed.large Kelsey Breseman

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Benson
  • 2,421
  • 34

Full instructions

A sassy virtual assistant, with Wolfram API access and real-world control

Baby Room Automation
  • 20,628
  • 109

Work in progress

Baby room automation and monitoring with Udoo.

Occupied
  • 6,532
  • 55

Full instructions

A toilet queueing app for serious poopers. Uses resin.io, firebase and twilio to notify people when the toilet is open - runs on the RPI.

Spark Core and Twilio
  • 3,497
  • 21

Full instructions

Calling a Twilio number to control Spark Core

eyephone
  • 546
  • 8

Full instructions

eyePhone. For creating an innovative solution for helping the blind identify color.

BabyBiCO 1.0
  • 826
  • 11

Work in progress

Smart monitor that tracks babies sleep and sleeping environment in order to give them a better sleep quality.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login