Twitter en lumière
Sommaire
Introduction
Les bases du code
Allumons la lumière
Un peu de logique
Connexion avec Twitter
#okapi
#bayard
Raspberry Pi
Micro-ordinateur
HDMI
USB
Ethernet
MicroSD
GPIO
700 Mhz
512 Mo
Ruby
irb
puts("Bonjour Okapi")
name = "Okapi"
puts("Bonjour " + name)
name = "Simplon"
puts("Bonjour " + name)
name.upcase()
Led.red()
load "led.rb"
Led.red()
Led.blue()
Led.pink()
Led.green()
Led.yellow()
Led.orange()
?
Bonjour
Hello
country = "France"
if country.include("France")
puts("Bonjour")
end
country = "England"
if country.include("France")
puts("Bonjour")
else
puts("Hello")
end
countries = ["France", "Mali", "Sénégal"]
country = "Mali"
if country.include(countries)
puts("Bonjour")
end
API Twitter
Twitter.when(["#okapi"]) do |tweet|
puts(tweet)
end
Twitter.when(["#okapi", "#bayard"]) do |tweet|
puts(tweet)
if tweet.include(["#okapi"])
Led.red()
end
end
Twitter.when(["#okapi", "#bayard"]) do |tweet|
puts(tweet)
if tweet.include(["#okapi"])
Led.red()
else
Led.yellow()
end
end
Twitter.when(["#okapi", "#bayard", "#jeunesse"]) do |tweet|
puts(tweet)
if tweet.include(["#okapi"])
Led.red()
elsif tweet.include(["#lacroix"])
Led.blue()
elsif tweet.include(["#jeunesse"])
Led.white()
end
end
load "sms.rb"
Twitter.when(["#okapi", "#bayard"]) do |tweet|
puts(tweet)
if tweet.include(["#okapi"])
Led.red()
Sms.send("+33650174288", tweet)
else
Led.yellow()
end
end
Merci
Made with Slides.com