merge develop 2
This commit is contained in:
commit
e8fd0d8d1b
|
|
@ -1,12 +1,18 @@
|
|||
#include <MeMCore.h
|
||||
#include <MeMCore.h>
|
||||
|
||||
MeDCMotor leftRotor(9);
|
||||
MeDCMotor rightRotor(10);
|
||||
float lSpeed;
|
||||
float rSpeed;
|
||||
float duration;
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
leftRotor.run(0);
|
||||
rightRotor.run(0);
|
||||
lSpeed = -100.0;
|
||||
rSpeed = 100.0;
|
||||
duration = 1000.0;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -17,4 +23,9 @@ void loop() {
|
|||
delay(duration);
|
||||
leftRotor.stop();
|
||||
rightRotor.stop();
|
||||
delay(duration);
|
||||
leftRotor.run(0-lSpeed);
|
||||
rightRotor.run(0-rSpeed);
|
||||
delay(duration);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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