Permalink
Browse files

Added README and Licensing

  • Loading branch information...
1 parent 32bdba1 commit 1aec22866f803c0ca9bb0d16bd9d5232213a5e35 @davejlong committed Jul 10, 2011
Showing with 268 additions and 2 deletions.
  1. +180 −0 LICENSE
  2. +43 −0 README.md
  3. +19 −0 conf.yml.sample
  4. +26 −2 twituino.rb
View
Oops, something went wrong.
View
@@ -0,0 +1,43 @@
+# Twituino - From Twitter to Arduino
+
+Twituino is designed to interact between Twitter and an Arduino board to do almost anything in the world. The way that it works is that
+Twituino is setup as an application on Twitter. Then it is given a user to monitor. Each time a message is sent to that user, Twituino
+will check the username of the sender against a whitelist and then run some code. After Twituino has successfully run the code it will
+send a reply to the user letting it know that it is done.
+
+## Setup
+There are a few pieces that need to be setup for Twituino to do it's job. The first thing is to register both a new twitter account and a
+new twitter app with that account. After both of those pieces are setup open the conf.yml file and plugin the necessary settings. Twituino
+uses a whitelist to make sure that only certain users can tell it to do things. Open twituino.rb and add your username to the whitelist.
+Twituino automatically loops through the whitelist following any users that it isn't already following.
+
+1. Create a twitter account for Twituino to use
+2. Create a twitter app on dev.twitter.com for Twituino
+3. Plug the user keys and app keys into the conf.yml file
+4. Add your username to the whitelist in twituino.rb
+
+## Adding the Arduino code
+Twituino is only a wrapper for interacting with Arduino. The actual code is up to you. In fact you don't even need to use Twituino with
+and Arduino board. Anything that you might want to interact with through Twitter messaging can be done with Twituino. To add code that will
+run when Twituino receives a message look for the comment at the end of twituino.rb marking the spot where Twituino has validated the message.
+
+If you want me to put some Arduino code in there please head over to my [Amazon withlist](https://www.amazon.com/wishlist/3O8DD5T5C2HMD/) and
+buy me an Arduino to test this out with.
+
+## Licensing
+Copyright (C) 2011 [David Long](http://davejlong.com)
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
View
@@ -1,3 +1,22 @@
+=begin
+ Copyright (C) 2011 [David Long](http://davejlong.com)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+=end
+
+
+
app:
oauth_consumer_token: **your oauth consumer token**
oauth_consumer_secret: **your oauth consumer secret**
View
@@ -1,10 +1,29 @@
+=begin
+ Copyright (C) 2011 [David Long](http://davejlong.com)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+=end
+
require 'rubygems'
gem 'twitter4r'
require 'yaml'
require 'twitter'
CONFIG = YAML::load_file "conf.yml"
+@userWhitelist = ['davejlong']
+
puts CONFIG
Twitter::Client.configure do |conf|
conf.oauth_consumer_token = APPCONFIG[:oauth_consumer_token]
@@ -16,7 +35,12 @@
:secret => USERCONFIG[:usersecret]
})
-@userWhitelist = ['davejlong']
+def follow_whitelist
+ @userWhitelist.each do |user|
+ user = @client.user user
+ client.friend :add, user
+ end
+end
def every_n_seconds(n)
loop do
@@ -27,7 +51,7 @@ def every_n_seconds(n)
end
end
-every_n_seconds(10) do |span|
+every_n_seconds(15) do |span|
m = @client.messages :received
startDate = (Time.now-span)
endDate = Time.now

0 comments on commit 1aec228

Please sign in to comment.