#jlcpcb #pcba #pcb #arduino
This one of a series from Popular Arduino Sensor Modules, coding easy, design easy with EasyEDA and Manufactured by JLCPCB.
Arduino Code:
int Led = 13 ;// Declaration of the LED output pin
int Sensor = 10 ;// Declaration of the sensor input pin
int val; // Temporary variable
void setup ()
{
pinMode (Led, OUTPUT) ; // Initialize output pin
pinMode (Sensor, INPUT) ; // Initialize sensor pin
digitalWrite(Sensor, HIGH) ; // Activate internal pull-up resistor
}
void loop ()
{
val = digitalRead (Sensor) ;
// The current signal at the sensor is read out
if (val == HIGH)
// If a signal could be detected, the LED is switched on.
{
digitalWrite (Led, LOW);
}
else
{
digitalWrite (Led, HIGH);
}
}
Sign Up to Get New User $54 Coupons: [ Ссылка ]
Don't forget to follow us for more content. JLCPCB
![](https://i.ytimg.com/vi/rdhmCRffKDQ/maxresdefault.jpg)