17 lines
300 B
C++
17 lines
300 B
C++
#include <MeMCore.h>
|
|
|
|
|
|
MeUltrasonicSensor sensor(3);
|
|
float distance;
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
Serial.begin(9600);
|
|
}
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
distance = sensor.distanceCm();
|
|
Serial.print(distance);
|
|
Serial.print("\n");
|
|
} |