Created
March 22, 2018 14:20
-
-
Save Antoinebr/2f0e01c42eff12b3c65dcc455b1a8165 to your computer and use it in GitHub Desktop.
espruino moisture-soil-sensor.js
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
function get() { | |
return analogRead(NodeMCU.A0 / 1023); | |
} | |
function percentage (){ | |
return Math.round(100 - ( get() * 100 ), 1); | |
} | |
setInterval ( () => { | |
console.log( percentage(),"%" ); | |
},3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment