From 18d9e49ba734c67d82ef0bcebaa265c31ecc3652 Mon Sep 17 00:00:00 2001 From: Johannes Krug Date: Thu, 14 Mar 2019 11:41:37 +0100 Subject: [PATCH] =?UTF-8?q?Erster=20Codeversuch=20Ultraschallsensor,=20bib?= =?UTF-8?q?liothek=20noch=20nicht=20korrekt=20Code=20noch=20nicht=20funkti?= =?UTF-8?q?onsf=C3=A4hig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arduino/SR04_Example/SR04_Example.ino | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 arduino/SR04_Example/SR04_Example.ino diff --git a/arduino/SR04_Example/SR04_Example.ino b/arduino/SR04_Example/SR04_Example.ino new file mode 100644 index 0000000..3304f62 --- /dev/null +++ b/arduino/SR04_Example/SR04_Example.ino @@ -0,0 +1,17 @@ +#include "SR04.h" +#define TRIG_PIN 3 +#define ECHO_PIN 4 +SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN); +long a; + +void setup() { + Serial.begin(9600); + delay(1000); +} + +void loop() { + a=sr04.Distance(); + Serial.print(a); + Serial.println("cm"); + delay(1000); +}