Skip to content

Instantly share code, notes, and snippets.


Nikolay-Kha/index.html Secret

Last active Feb 27, 2018
What would you like to do?
Si7021 example
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="libs.js"></script>
function read_sensor() {
{"SDA": 12, "SCL":14, "address":"0x80"}, null,
function (err, res) {
if(err) {
document.getElementById("t").innerHTML = "ERROR: " + res;
document.getElementById("h").innerHTML = "";
} else {
document.getElementById("t").innerHTML = res["temperature"].toFixed(2);
document.getElementById("h").innerHTML = res["humidity"].toFixed(2);
setTimeout(read_sensor, 1000);
<body onload="read_sensor()">
<div class="header">
<a href="/"><div class="devecihive-logo-text"></div></a>
<div class="content">
<div style="display: inline-block; float: left">
<div style="display: inline-block; padding-left: 20px">
<div id="t"></div>
<div id="h"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment