arduino rgb led strip driver
[clinton/scratch.git] / led-web.scm
1 (use-modules (ice-9 match)
2
3 (web server)
4 (web request)
5 (web response)
6 (web uri))
7
8 (define (led-command-handler request body)
9 (match (split-and-decode-uri-path (uri-path (request-uri request)))
10 (("set" "rgb" r g b)
11 (set-led-color/primitive! (string->number r)
12 (string->number g)
13 (string->number b))
14 (display "Set rgb\n")
15 (values '((content-type . (text/plain)))
16 "rad\n"))
17 (_ (values '((content-type . (text/plain))) "luser\n"))))
18
19 (run-server led-command-handler)