Skip to content

Instantly share code, notes, and snippets.

@timlambrecht
Last active April 25, 2019 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timlambrecht/29ded1ff87dd9e53f1d53b6fcd512c88 to your computer and use it in GitHub Desktop.
Save timlambrecht/29ded1ff87dd9e53f1d53b6fcd512c88 to your computer and use it in GitHub Desktop.
Code for three sensors
#include "MeOrion.h"
MeUltrasonicSensor SensorL(PORT_3);
MeUltrasonicSensor SensorM(PORT_7); /* Ultrasonic module can ONLY be connected to port 3, 4, 6, 7, 8 of base shield. */
MeUltrasonicSensor SensorR(PORT_8);
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("SensorL : ");
Serial.print(SensorL.distanceCm() );
Serial.println(" cm");
Serial.print("SensorM : ");
Serial.print(SensorM.distanceCm() );
Serial.println(" cm");
Serial.print("SensorR : ");
Serial.print(SensorR.distanceCm() );
Serial.println(" cm");
delay(100); /* the minimal measure interval is 100 milliseconds */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment