gyro start
This commit is contained in:
parent
53d41062f6
commit
20e87d0eb9
|
|
@ -0,0 +1,17 @@
|
|||
#include <MeMCore.h>
|
||||
|
||||
MeGyro myGyro(4);
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
myGyro.begin();
|
||||
Serial.print("Y axis gyro ");
|
||||
Serial.println(myGyro.getAngleY());
|
||||
Serial.print("X axis gyro ");
|
||||
Serial.println(myGyro.getAngleX());
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ void setup() {
|
|||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
getMoving(150, 1, -1, 500);
|
||||
if (mySensor.distanceCm()< 20){
|
||||
if (mySensor.distanceCm()< 25){
|
||||
_leftMotor.stop();
|
||||
_rightMotor.stop();
|
||||
valTurn = (int) random(0, 2)*2-1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue