zoukankan      html  css  js  c++  java
  • OLED液晶屏幕(0)自动获取12ic地址液晶屏幕

    烧录

    串口可以看到输出的地址

    #include <Wire.h>
     
    void setup(){
      Wire.begin();
      Serial.begin(9600);
      Serial.println("
    I2C Scanner");
    }
    void loop(){
      byte error, address;
      int nDevices;
      Serial.println("Scanning...");
      nDevices = 0;
      for (address = 1; address < 127; address++ ){
        // The i2c_scanner uses the return value of
        // the Write.endTransmisstion to see if
        // a device did acknowledge to the address.
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
        if (error == 0){
          Serial.print("I2C device found at address 0x");
          if (address < 16)
            Serial.print("0");
          Serial.print(address, HEX);
          Serial.println(" !");
          nDevices++;
        }else if (error == 4){
          Serial.print("Unknow error at address 0x");
          if (address < 16)
            Serial.print("0");
          Serial.println(address, HEX);
        }
      }
      if (nDevices == 0)
        Serial.println("No I2C devices found
    ");
      else
        Serial.println("done
    ");
      delay(5000); // wait 5 seconds for next scan
    }
    

      

  • 相关阅读:
    爬虫框架scrapy(1)持久化存储的多种方式及多页爬取数据
    爬虫之selenium
    redis相关
    爬虫之数据解析
    爬虫之requests模块2
    爬虫之requests模块
    HTTP和HTTPS协议
    Pymongo使用
    MongoDB
    python网络编程之黏包问题
  • 原文地址:https://www.cnblogs.com/kekeoutlook/p/10810701.html
Copyright © 2011-2022 走看看