Skip to content

Instantly share code, notes, and snippets.

@jlengrand
Created July 29, 2020 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlengrand/f7c581791480e04173388815e1a9a6df to your computer and use it in GitHub Desktop.
Save jlengrand/f7c581791480e04173388815e1a9a6df to your computer and use it in GitHub Desktop.
package nl.lengrand.cellar;
public class TestLib {
public static void main(String[] args) throws InterruptedException {
Dht11Driver theDriver = new Dht11Driver();
System.out.println("Hello JNI!");
for (int i = 0; i < 5; i++) {
float [] res = theDriver.getTemperatureAndHumidity();
if(res[0] != 0 && res[1] != 0){
System.out.println("Receiving " + res[0] + " " + res[1]);
}
else{
System.out.println("Incorrect data!" + res[0] + " " + res[1]);
}
Thread.sleep(1000);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment