Ultrasound
This commit is contained in:
parent
4ef9ba22ab
commit
7292715015
|
|
@ -0,0 +1,9 @@
|
||||||
|
void setup() {
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#include "MeMCore.h"
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
MeUltrasonicSensor ultraSensor(PORT_3); /* Ultrasonic module can ONLY be connected to port 3, 4, 6, 7, 8 of base shield. */
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
Serial.print("Distance : ");
|
||||||
|
Serial.print(ultraSensor.distanceCm() );
|
||||||
|
Serial.println(" cm");
|
||||||
|
delay(200); /* the minimal measure interval is 100 milliseconds */
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue