MBot Ranger OnBoard Gyro Not Working


#1

Hello, I am using an Arduino to get the values of my on board gyro, the code I have used is the example code from the mbot library, when I upload the code, the x, y and z values are all 0.
The code is below:

#include “MeAuriga.h”
#include <Wire.h>

MeGyro gyro;
void setup()
{
Serial.begin(9600);
gyro.begin();
}

void loop()
{
gyro.update();
Serial.read();
Serial.print(“X:”);
Serial.print(gyro.getAngleX() );
Serial.print(" Y:");
Serial.print(gyro.getAngleY() );
Serial.print(" Z:");
Serial.println(gyro.getAngleZ() );
delay(10);
}


#2

“Megyro gyro” part,
You should change it to “Megyro gyro (0,0x69);”. ("Is not related to text.)


#3

@dai5_jp Thank you so much, it works now


#4

@dai5_jp would you know how to control the two dc motors from the mbot ranger with arduino? i have tried using the test code but, nothing happens.


#5

Would you please upload your test code here?


#6

@dai5_jp
#include “MeAuriga.h”

MeDCMotor motor1(M1);

MeDCMotor motor2(M2);

uint8_t motorSpeed = 100;

void setup()
{
}

void loop()
{
motor1.run(motorSpeed); /* value: between -255 and 255. /
motor2.run(motorSpeed); /
value: between -255 and 255. */

}


#7

Would you please put a photo of the motor?


#8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.