Skip to content

Instantly share code, notes, and snippets.

@SteveAmor
Created November 25, 2016 09:30
Show Gist options
  • Save SteveAmor/8223f4ca0f91517474e2bec0f13ab6a7 to your computer and use it in GitHub Desktop.
Save SteveAmor/8223f4ca0f91517474e2bec0f13ab6a7 to your computer and use it in GitHub Desktop.
<!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