gyro sensor implementation
This commit is contained in:
parent
072de87350
commit
6ada7eb46a
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include <MeMCore.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
|
||||||
|
MeGyro gyro(4);
|
||||||
|
|
||||||
|
|
||||||
|
float distance;
|
||||||
|
float lSpeed;
|
||||||
|
float rSpeed;
|
||||||
|
float duration;
|
||||||
|
int Side;
|
||||||
|
double angleZ;
|
||||||
|
double gyroX;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
Serial.begin(9600);
|
||||||
|
gyro.begin();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
|
||||||
|
gyro.update();
|
||||||
|
angleZ = gyro.getAngleZ();
|
||||||
|
Serial.println(gyro.getAngleZ()));
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue