tm1637's Introduction
#include <TM1637.h> #include <dht.h> int CLK = 2; int DIO = 3; TM1637 tm(CLK,DIO); #define dht_apin A0 // Analog Pin sensor is connected to dht DHT; void setup() { Serial.begin(9600); pinMode(8,OUTPUT); pinMode(7,OUTPUT); delay(500);//Delay to let system boot Serial.println("DHT11 Humidity & temperature Sensor\n\n"); delay(1000);//Wait before accessing Sensor DHT.read11(dht_apin); Serial.print("Current humidity = "); Serial.print(DHT.humidity); Serial.print("% "); Serial.print("temperature = "); Serial.print(DHT.temperature); Serial.println("C "); // put your setup code here, to run once: tm.init(); //set brightness; 0-7 tm.set(2); } void loop() { // put your main code here, to run repeatedly: Serial.println("DHT11 Humidity & temperature Sensor\n\n"); delay(1000);//Wait before accessing Sensor DHT.read11(dht_apin); Serial.print("Current humidity = "); Serial.print(DHT.humidity); Serial.print("% "); Serial.print("temperature = "); Serial.print(DHT.temperature); Serial.println("C "); tm.display(3,0); tm.display(2,12); tm.point(1); delay(1000); displayNumber(DHT.temperature); delay(1000); if(DHT.temperature >= 28.0){ Serial.print("28>="); Serial.print("LOW\n"); digitalWrite(8,LOW); digitalWrite(7,LOW); delay(2000); } if (DHT.temperature <= 27.0 ){ Serial.print("27<="); digitalWrite(8,HIGH); digitalWrite(7,HIGH); Serial.print("HIGH\n"); delay(2000); } } void displayNumber(int num){ tm.display(1, num % 10); tm.display(0, num / 10 % 10); //tm.display(1, num / 100 % 10); //tm.display(0, num / 1000 % 10); }
tm1637's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.