sense the distance with the ultrasonic sensor, and serial.print it
This commit is contained in:
parent
25c8ad4ebc
commit
1c3402a245
|
|
@ -0,0 +1,17 @@
|
|||
#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");
|
||||
}
|
||||
Loading…
Reference in New Issue