Codey Online › Arduino- & ESP32-Komponentenbibliothek › HW-201 Infrared Obstacle Avoidance Module
HW-201 Infrared Obstacle Avoidance Module
Sensoren

HW-201 Infrared Obstacle Avoidance Module

HW-201 Infrarot-Hindernisvermeidungsmodul, Näherungsschalter für Smart Car und Arduino

Breite: 38.1 mm

Pinbelegung — HW-201 Infrared Obstacle Avoidance Module

Pin Signal Beschreibung
VCC power Positive supply input for the IR obstacle sensor module, typically 3.3–5V.
GND ground Ground reference for power and the OUT signal.
OUT digital Digital comparator output indicating obstacle detection, usually active-low.

Beispielschaltplan — HW-201 Infrared Obstacle Avoidance Module

Von Nach Kabel
board:5V x1:VCC red
board:GND x1:GND black
board:D2 x1:OUT green

Arduino-Beispielcode — HW-201 Infrared Obstacle Avoidance Module

Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.

// HW-201 Infrared Obstacle Avoidance Module
// Reads the module's digital OUT pin and prints obstacle status to Serial.
// Many HW-201 modules are active-low: OUT goes LOW when an obstacle is detected.

const int sensorPin = 2;

void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  Serial.println("HW-201 Infrared Obstacle Avoidance Module");
  Serial.println("Active-low output: LOW = obstacle detected, HIGH = no obstacle");
}

void loop() {
  int state = digitalRead(sensorPin);

  if (state == LOW) {
    Serial.println("Obstacle detected");
  } else {
    Serial.println("No obstacle");
  }

  delay(200);
}

Ähnliche Komponenten

PIR Sensor HC-SR501

PIR Sensor HC-SR501

TOF200C VL53L0X Distance Sensor Time-Of-Flight high precision

TOF200C VL53L0X Distance Sensor Time-Of-Flight high precision

TOF400C-VL53L1X Distance sensor Time-Of-Flight very accurate 4-400cm

TOF400C-VL53L1X Distance sensor Time-Of-Flight very accurate 4-400cm

HC-SR501 PIR Motion Sensor

HC-SR501 PIR Motion Sensor

Bau dein Arduino- oder ESP32-Projekt mit AI

Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.

Kostenlos starten