久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2716|回復: 0
打印 上一主題 下一主題
收起左側

arduino控制陀螺儀

[復制鏈接]
跳轉到指定樓層
樓主
#include "Wire.h"

// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;

int16_t ax, ay, az;
int16_t gx, gy, gz;

#define LED_PIN 13
bool blinkState = false;

void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
    Wire.begin();

    // initialize serial communication
    // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
    // it's really up to you depending on your project)
    Serial.begin(38400);

    // initialize device
    Serial.println("Initializing I2C devices...");
    accelgyro.initialize();

    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

    // configure Arduino LED for
    pinMode(LED_PIN, OUTPUT);
}

void loop() {
    // read raw accel/gyro measurements from device
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

    // these methods (and a few others) are also available
    //accelgyro.getAcceleration(&ax, &ay, &az);
    //accelgyro.getRotation(&gx, &gy, &gz);

    // display tab-separated accel/gyro x/y/z values
    Serial.print("a/g:\t");
    Serial.print(ax); Serial.print("\t");
    Serial.print(ay); Serial.print("\t");
    Serial.print(az); Serial.print("\t");
    Serial.print(gx); Serial.print("\t");
    Serial.print(gy); Serial.print("\t");
    Serial.println(gz);

    // blink LED to indicate activity
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);
}


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 男女羞羞视频在线 | 成人国产一区二区三区精品麻豆 | 一区二区三区免费 | 色综合久久88色综合天天 | 毛片在线免费 | 日本精品久久久久久久 | 水蜜桃久久夜色精品一区 | 国产精品不卡视频 | 久久久久久久国产精品影院 | 中文字幕一级毛片视频 | 亚洲精品一区二区另类图片 | 99re热精品视频 | 国产精品一区在线 | 精品欧美一区二区久久久伦 | 久久九精品 | 久久国产日韩欧美 | 超碰美女在线 | 欧美日韩不卡合集视频 | 日韩一区二区免费视频 | 久久久久久99 | 亚洲电影中文字幕 | 欧美精品在线一区二区三区 | 国产成人福利 | 国产第一亚洲 | 天堂一区二区三区 | 在线激情视频 | 成人午夜免费网站 | 亚洲欧美在线免费观看 | 午夜精品久久久久久久久久久久久 | 国产精品一区在线观看 | 妹子干综合 | 国产精品久久久久久久久久久久午夜片 | 国产欧美视频一区二区三区 | 亚洲精品电影网在线观看 | 在线一区二区三区 | 中文字幕一区二区三区不卡 | 国产日韩欧美在线播放 | 嫩草一区二区三区 | 成人免费视频观看 | 二区成人 | 精品欧美一区二区三区免费观看 |