I'm trying to use a SEN136B5B ultrasonic rangefinder with an arduino nano BLE 33. I'll put my code and the pinout below, but I am receiving no readings and only constant values of 0. I've tried altering the ping delay, but nothing seems to work. Any ideas?
const int pingPin = D6;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
long duration, inches, cm;
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);
duration - pulseIn(pingPin, HIGH);
Serial.print(duration);
delay(100);
}
