Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
lukasmaximus89
Published © LGPL

Grove Ultrasonic Sensor with M5Stack

Simple setup of a Seeed Studio Grove ultrasonic sensor (not HC-SR04) in Arduino.

BeginnerProtip1 hour5,666
Grove Ultrasonic Sensor with M5Stack

Things used in this project

Story

Read more

Code

ultrasonicM5Stack

Arduino
simple setup for using the ultrasonic ranger with m5stack
//Make sure to install

#include <M5Stack.h>
#include "Ultrasonic.h"

Ultrasonic ultrasonic(22);
void setup()
{
  M5.begin();
}
void loop()
{
	long RangeInInches;
	long RangeInCentimeters;

	RangeInCentimeters = ultrasonic.MeasureInCentimeters(); // two measurements should keep an interval
	M5.Lcd.setCursor(10, 0);
	M5.Lcd.print(RangeInCentimeters);//0~400cm
  //M5.Speaker.tone(RangeInCentimeters, 200);
	delay(250);
}

Credits

lukasmaximus89

lukasmaximus89

38 projects • 34 followers
I'm Luke from Manchester, UK. I've been living in shenzhen for 6 years. I do 3D design, Basic Electronics, Casting and other cool stuff.

Comments