zoukankan      html  css  js  c++  java
  • Arduino control Eeprom by IIC method of using device address in Arduino

    参考:

    1.https://www.arduino.cc/

    2.https://www.arduino.cc/reference/en/

    3.https://www.arduino.cc/en/Reference/Wire

    4.https://www.arduino.cc/en/Reference/WireRead

    5.https://www.arduino.cc/en/Reference/WireWrite

    6.https://github.com/settings/installations

    写入方法:


    void  writeway(int address , int val)
    {
      Wire.beginTransmission(0x50); // transmit to device #44 (0x2c)    // eeprom device address 0x50
                                   // device address is specified in datasheet

     Wire.write(address);
      Wire.write(val);             // sends value byte  
      Wire.endTransmission();     // stop transmitting

      val++;        // increment value
      if(val == 64) // if reached 64th position (max)
      {
        val = 0;    // start over from lowest value
      }
      delay(5);
    }

    读取方法:

    int readway (int address)
    {

     Wire.beginTransmission(0x50); // transmit to device #44 (0x2c)    // eeprom device address 0x50                                // device address is specified in datasheet

     Wire.write(address);         // sends value byte  

     Wire.endTransmission();     // stop transmitting


      Wire.requestFrom(2, 6);    // request 6 bytes from slave device #2

      while(Wire.available())    // slave may send less than requested
      {
      //  char c = Wire.read();    // receive a byte as character
     //   Serial.print(c);         // print the character
      }

    return Wire.read();
    }

  • 相关阅读:
    Expression 学习 [1]
    代码格式化工具 CodeMaid
    深度复制
    Linq to entity 笔记
    Linq To SQL Update Delete
    sphinx 安装 笔记
    过滤HTML 脚本 样式 避免样式冲突
    TFS 文件显示 未下载 却无法下载到本地 文件路径版定问题解决
    生成实体文件 需要用到的SQL 语句
    应用程序 数据缓存
  • 原文地址:https://www.cnblogs.com/MCSFX/p/10830824.html
Copyright © 2011-2022 走看看