Erster Codeversuch Ultraschallsensor, bibliothek noch nicht korrekt
Code noch nicht funktionsfähig
This commit is contained in:
parent
56e6f298aa
commit
18d9e49ba7
17
arduino/SR04_Example/SR04_Example.ino
Normal file
17
arduino/SR04_Example/SR04_Example.ino
Normal file
@ -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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user