gyro start

This commit is contained in:
Loic Delattre 2023-04-24 10:17:27 +02:00
parent 53d41062f6
commit 20e87d0eb9
2 changed files with 18 additions and 1 deletions

17
gyro/gyro.ino Normal file
View File

@ -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());
}

View File

@ -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;