HC-SR501
HC-SR501 ir infrasarkano staru kustības sensora modulis.
Parametri
HC-SR501 aprakstsSlēguma shēma
Savienojam HC-SR501 (GND) ar Arduino (GND), HC-SR501 (OUT) ar Arduino Digital I/O (8), HC-SR501 (VCC) ar Arduino (5V).
Savienojam LED katodu (-) ar Arduino (GND), LED anodu (+) caur 330Ω pretestību ar Arduino Digital I/O (7).
Arduino koda piemērs
// define constants
const int sensorPin = 8;
const int ledPin = 7;
// define variable
int sensorState = 0;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital sensorPin as an input and ledPin as output
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
// read sensorPin value and assign it to sensorState variable
sensorState = digitalRead(sensorPin);
// set ledPin to sensorState value
digitalWrite(ledPin, sensorState);
// pause for 100ms
delay(100);
}
HC-SR501 PIR kustības sensora modulis (zils ar džamperi)
- Modelis: HC-SR501 blue with jumper
- SKU: 0046
- Pieejamība: 14
-
4,24€
Saistītās preces
Atslēgvārdi: HC-SR501, PIR, kustības, sensora, sensors, modulis, zils, zila, džamperi, džamperis, motion, sensor, module, blue, jumper, arduino, esp, raspberry