Created
November 25, 2016 09:30
-
-
Save SteveAmor/8223f4ca0f91517474e2bec0f13ab6a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
<title>Cheerlights</title> | |
</head> | |
<body> | |
<script> | |
setInterval(function() { | |
// get cheerlights color from field2 with a webservice call | |
$.getJSON('https://api.thingspeak.com/channels/1417/feed/last.json?callback=?', function (data) { | |
// if the field2 has data, update background color of the page | |
if (data.field2) { | |
$("body").css("background-color", data.field2); | |
} | |
}); | |
}, 1000); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment