Digital temperature sensor module KY-028
The digital temperature module and the digital 13 interface have their own LED to build a simple circuit and make a temperature warning lamp.
The digital temperature sensor is connected to the digital 3 interface by using the LED of the digital 13 interface. When the digital temperature sensor senses a key signal, the LED turns on, otherwise it turns off.
Routine source code:
int Led=13; //Define the LED interface
int buttonpin=3; //Define the digital temperature sensor interface
int val; //Define the numeric variable val
void setup()
{pinMode(Led,OUTPUT); //Define LED as output interface.
pinMode(buttonpin,INPUT); //Define the digital temperature sensor as the output interface.}
void loop()
{val=digitalRead(buttonpin); //Assign the value reading of digital interface 3 to val.
If(val==HIGH)// When the digital temperature sensor detects a signal, the LED flashes.
{digitalWrite(Led,HIGH);}
else
{digitalWrite(Led,LOW);
Reviews
There are no reviews yet.