    gpio18.state = val
 
 
+gpio22.on 'change', (val) ->
+  console.log "22 changed to #{val}"
+
+gpio22.on 'change', (val) ->
+  gpio23.set(val)
+
+
 app.listen app.get('port'), ->
   console.log "Listening on port #{app.get('port')}"

gpio = require 'gpio'
app = express()
gpio18 = gpio.export 18


app.configure ->
  app.set 'port', process.env.PORT or 4000


app.get '/off/18', (req, res) ->
  gpio18.reset()
  clearInterval beatsInterval
  res.send('off')

app.get '/beats/18', (req, res) ->
  beatsInterval = setInterval ->
    gpio18.set()
    setTimeout ->
      gpio18.reset()
    , 200
  , 1000
  res.send('beats started')



app.get '/toggle/18', (req, res) ->
