Twitter en lumière
Sommaire
-
Introduction
-
Les bases du code
-
Allumons la lumière
-
Un peu de logique
-
Connexion avec Twitter
-
L'envoi de SMS
#orange
#simplon
Raspberry Pi
Micro-ordinateur
- HDMI
- USB
- Ethernet
- MicroSD
- GPIO
- 700 Mhz
- 512 Mo
Ruby
irb
puts("Bonjour Orange")
name = "Orange"
puts("Bonjour " + name)
name = "simplon"
puts("Bonjour " + name)
name.upcase()
load "led.rb"
Led.orange()
Led.red()
Led.blue()
Led.pink()
Led.green()
Led.yellow()
Led.orange()
?
Bonjour
Holla
Hello
country = "France"
if country.include("france")
puts("Bonjour")
end
country = "England"
if country.include("France")
puts("Bonjour")
else
puts("Hello")
end
if country.include("France ")
puts("Bonjour")
elsif country.include("Spain")
puts("Holla")
else
puts("Hello")
end
countries = ["France", "Mali", "Sénégal"]
country = "Mali"
if country.include(countries)
puts("Bonjour")
end
Twitter.when(["#orange"]) do |tweet|
puts(tweet)
end
Twitter.when(["#orange", "#simplon"]) do |tweet|
puts tweet
if tweet.include(["#orange"])
Led.orange()
end
end
Twitter.when(["#orange", "#simplon"]) do |tweet|
puts tweet
if tweet.include(["#orange"])
Led.orange()
else
Led.red()
end
end
load "sms.rb"
Twitter.when(["#orange", "#simplon"]) do |tweet|
puts tweet
if tweet.include(["#orange"])
Led.orange()
Sms.send("+33650174288", tweet)
else
Led.red()
end
end
Merci
Twitter en lumière
By aghaniyassin
Twitter en lumière
- 1,070