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

npx: Neopixels for Tessel, made easy
  • 2,110
  • 6

Full instructions

New abstractions for Tessel Neopixels

BLE Proximity-based Switch
  • 7,386
  • 11

Full instructions

Switches on a relay when BLE device is in range

Website Down Alarm
  • 3,697
  • 18

Full instructions

Pings a URL and causes an alarm light to flash if the status code is not 200.

tessel-button
  • 1,616
  • 5

Full instructions

A button on Tessel's GPIO bank

Nokia 5110 Graphic LCD DIY Module
  • 2,711
  • 4

Full instructions

Tessel library for interacting with the Nokia 5110 Graphic LCD

RFID Process Tracker
  • 2,422
  • 10

Full instructions

Uses different RFID readers to track RFID-tagged items through a process

Add projectSign up / Login