Tweet with "#obniz"! Flag will shake!

このエントリーをはてなブックマークに追加

How it works

It shake a flag when someone tweet with hashtag “#obniz”.

Materials

  1. obniz – 1
  2. servomotor – 1
  3. flag – 1
  4. battery or usb adaptor & cable – 1

Program

// Nodejs

var Obniz = require('obniz');
var Twitter = require('twitter');

var obniz = new Obniz("0000-0000");
 
obniz.onconnect = function(){
  var servo = obniz.wired("ServoMotor", {signal:0,vcc:1, gnd:2});
  servo.angle(10);
}
 
var client = new Twitter({
  consumer_key: '<ConsumerKey>',
  consumer_secret: '<Secret>',
  access_token_key: '<TokenKey>',
  access_token_secret: '<TokenSecret>'
});
 
var stream = client.stream('statuses/filter',
 {track: '#obniz'});
stream.on('data', function(event) {
  if (event) {
    var count = 0;
    var angles = [10,50,10,50,10,50,10]
    var timer = setInterval(function(){
      count++;
      servo.angle(angles[count]);
      if (count >= 6){
        clearInterval(timer);
      }
    }, 1000);
  }
});

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us