access to the mpu 5060 array

Posted on
  • Hi,

    I don't know ho i can get access to te mpu.getDegreesPerSecond(); array

    for example i want to make interaction if the y has a specific value with a if els condition.

    please help me?

    Thanks a lot...

  • Uh?

    If you're talking about the mpu6050, that function returns an array with three members.

    (this code isn't tested, ofc - I don't have that part)

    var mpu=require("MPU6050").connect();
    var t = mpu.getDegreesPerSecond();
    if (t[1] > some_number ) { //t[1] is the second member of the array, hence Y axis
    console.log("Wheee! y rotation rate is "+t[1].toString());
    } else { 
    console.log("Booo! y rotation rate is only "+t[1].toString());
    }
    
  • Ok, it's clear now.

    Thank you.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

access to the mpu 5060 array

Posted by Avatar for Bert-Holland @Bert-Holland

Actions