Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
tutorials_temperature [2016/02/24 05:50]
admin created
tutorials_temperature [2016/05/04 16:58]
admin Add nicer formatted code via GitHub
Line 7: Line 7:
 We will need to use a dedicated library written specially for it. Download the library from {{::​sht2x.zip| here}} and unzip its contents into the folder named //​Arduino\libraries//​ or use Arduino IDE's Add ZIP Library command. We will need to use a dedicated library written specially for it. Download the library from {{::​sht2x.zip| here}} and unzip its contents into the folder named //​Arduino\libraries//​ or use Arduino IDE's Add ZIP Library command.
    
-<code C> +<html><script src="​https:​//gist.github.com/deathmeek/50b0c204290ea49e8f4d3bc61d142137.js"></script></html>
-#​include ​<Wire.h>​ +
-#include <​SHT2x.h>​ +
-  +
-int controlPin ​7; +
-  +
-void setup() +
-+
-  pinMode(controlPin,​ OUTPUT);  ​//sensor on/off control +
-  +
-  Wire.begin(); +
-  Serial.begin(9600);​ +
- +
-  digitalWrite(controlPin,​ LOW); //enable all sensors +
-+
-  +
-void loop() +
-+
-   +
-  +
-  Serial.print("Humidity(%RH):​ "); +
-  Serial.print(SHT2x.GetHumidity());​ +
-  Serial.print(" ​    ​Temperature(C):​ "); +
-  Serial.println(SHT2x.GetTemperature());​ +
-  +
-  ​//​digitalWrite(controlPin,​ HIGH); //disable all sensors +
-  +
-  delay(1000);​ +
-+
- +
-</code> +