Skip to content

Instantly share code, notes, and snippets.

@Antoinebr
Created March 22, 2018 14:20
Show Gist options
  • Save Antoinebr/2f0e01c42eff12b3c65dcc455b1a8165 to your computer and use it in GitHub Desktop.
Save Antoinebr/2f0e01c42eff12b3c65dcc455b1a8165 to your computer and use it in GitHub Desktop.
espruino moisture-soil-sensor.js
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