Skip to content

PING 28015 ultrasonic sensor

Jaume Olivé Petrus edited this page Sep 17, 2017 · 22 revisions

Specification

What Comments
Identifier PING28015
Interface GPIO 1 pin
Provides distance meters
Properties temperature sound speed depends on ambient temperature
Datasheet

Code

-- Attach sensor to GPIO26
s = sensor.attach("PING28015", pio.GPIO26)

-- We tell to PING28015 that ambient temperature are 25º for adjust
-- the sound speed, used internally for calculate the distance from an
-- object
s:set("temperature", 25)

while true do
  print("distance: "..s:read("distance"))
  tmr.delayms(500)
end

Back to sensor list

Clone this wiki locally