Quotation by Barack Obama

I always tell my staff, “Better is good.” Better may not be as good as the best, but better is surprisingly hard to obtain.

Barack Obama

Advertisements

Grove Compatibility Matrix

Module Wio Arduino Raspberry Pi
Button Y Y Y
Buzzer Y Y Y
Gas Sensor Y Y
GPS N Y
IR Kit Y Y
LED Bar Y Y
LED RGB Backlight N Y
LED Socket Kit Y Y
Light Sensor Y Y
RF Kit 433 Mhz N Y
Relay Y Y
Rotary Angle Sensor Y Y
Sound Sensor Y Y
Temperature & Humidity Sensor Y Y
Temperature Sensor Y Y
Touch Sensor Y Y
Ultrasonic Ranger Y Y
Voltage Divider Y Y

How to Measure Distance with a Grove Ultrasonic Ranger in Arduino

W/ Base Shield

1) Connect the module to the D2 port.

2) Run the following code:

#include <Ultrasonic.h>

const inst PIN = 2;

Ultrasonic ultrasonic(PIN);

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(ultrasonic.MeasureInCentimeters()); // or MeasureInInches()
}

W/o Base Shield