Skip to content

Instantly share code, notes, and snippets.

@maxsu
Last active December 20, 2015 10:39
Show Gist options
  • Save maxsu/6116832 to your computer and use it in GitHub Desktop.
Save maxsu/6116832 to your computer and use it in GitHub Desktop.
Rasberry Pi: I Require only the finest Bean
#####################################################################
#
# Author: Max Suica
#
# License: CC-BY-SA
#
# Description: This is some ruby code that will allow a Rasberry Pi
# to make coffee after receiving a command from Siri.
#
# Dependencies:
#
# Siri Proxy: https://github.com/plamoni/SiriProxy
# (example): http://goo.gl/ojorTL
#
# Wiring Pi: http://wiringpi.com/
# Ruby: https://github.com/WiringPi/WiringPi-Ruby
# PHP: https://github.com/WiringPi/WiringPi-PHP
#
# Credits: This Ars Technica article: http://goo.gl/xNKUBC
# Shows off DarkTherapy's Siri powered garage opener:
# http://goo.gl/K3UV7t
#
#######################################################################
require 'cora'
require 'siri_objects'
require 'pp'
require 'wiringpi'
# Receive Request
listen_for /please make some coffee/i do
# Respond (Via Siri)
say "I require only the FINEST BEAN"
# Make Coffee for 10 minutes
CoffeeCoffee(10)
# Announce Coffee (Via Siri)
say "Coffee is ready!"
request_completed
end
# Coffee Pot control code
def CoffeeCoffee(minutes) do
system("gpio mode 1 out")
system("gpio write 1 1")
system("sleep #{60*minutes}")
system("gpio write 1 0")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment