导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. gd3p
    G
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    gd3p

    @gd3p

    2
    声望
    13
    楼层
    1133
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    gd3p 关注

    gd3p 发布的帖子

    • RE: arduino_spi_slave 从设备通信错误

      @kidswong999 好的 谢谢

      发布在 OpenMV Cam
      G
      gd3p
    • RE: arduino_spi_slave 从设备通信错误

      @kidswong999 0_154676022284UCQ.png

      那是使用arduino软件版本的问题吗?我使用的是arduino1.0.6

      发布在 OpenMV Cam
      G
      gd3p
    • arduino_spi_slave 从设备通信错误

      #include <SPI.h>
      #define SS_PIN 10
      #define BAUD_RATE 19200
      #define CHAR_BUF 128
      void setup() {
      pinMode(SS_PIN, OUTPUT);
      Serial.begin(BAUD_RATE);
      SPI.begin();
      SPI.setBitOrder(MSBFIRST);
      SPI.setClockDivider(SPI_CLOCK_DIV16);
      SPI.setDataMode(SPI_MODE0);
      delay(1000); // Give the OpenMV Cam time to bootup.
      }
      void loop() {
      int32_t temp = 0;
      char buff[CHAR_BUF] = {0};
      digitalWrite(SS_PIN, LOW);
      delay(1); // Give the OpenMV Cam some time to setup to send data.
      if (SPI.transfer(1) == 85) { // saw sync char?
      SPI.transfer(&temp, 4); // get length
      int zero_legnth = 4 + ((temp + 1) % 4);
      if (temp) {
      SPI.transfer(&buff, min(temp, CHAR_BUF));
      temp -= min(temp, CHAR_BUF);
      }
      while (temp--) SPI.transfer(0); // eat any remaining bytes
      while (zero_legnth--) SPI.transfer(0); // eat zeros.
      }
      digitalWrite(SS_PIN, HIGH);
      Serial.print(buff);
      delay(1); // Don't loop to quickly.
      }
      sketch_jan03a.ino: In function 'void loop()':
      sketch_jan03a:23: error: no matching function for call to 'SPIClass::transfer(int32_t*&, int)'
      D:\360Downloads\Arduino\libraries\SPI/SPI.h:55: note: candidates are: static byte SPIClass::transfer(byte)
      sketch_jan03a:24: error: invalid operands of types 'int32_t*' and 'int' to binary 'operator%'
      sketch_jan03a:26: error: ISO C++ forbids comparison between pointer and integer
      sketch_jan03a:26: error: operands to ?: have different types 'int32_t*' and 'int'
      sketch_jan03a:27: error: ISO C++ forbids comparison between pointer and integer
      sketch_jan03a:27: error: operands to ?: have different types 'int32_t*' and 'int'

      arduino UNO的板子应该没错吧 SPI.transfer(&temp, 4); // get length
      transfer第一个参数应该数传输的数组吧 这个程序传输的是数组吗?

      发布在 OpenMV Cam
      G
      gd3p
    • RE: arduino_spi_slave 从设备通信错误

      @kidswong999 arduino UNO的板子应该没错吧 SPI.transfer(&temp, 4); // get length
      transfer第一个参数应该数传输的数组吧 这个程序传输的是数组吗?

      发布在 OpenMV Cam
      G
      gd3p
    • arduino_spi_slave 从设备通信错误

      #include <SPI.h>
      #define SS_PIN 10
      #define BAUD_RATE 19200
      #define CHAR_BUF 128

      void setup() {
      pinMode(SS_PIN, OUTPUT);
      Serial.begin(BAUD_RATE);
      SPI.begin();
      SPI.setBitOrder(MSBFIRST);
      SPI.setClockDivider(SPI_CLOCK_DIV16);
      SPI.setDataMode(SPI_MODE0);
      delay(1000); // Give the OpenMV Cam time to bootup.
      }

      void loop() {
      int32_t temp = 0;
      char buff[CHAR_BUF] = {0};
      digitalWrite(SS_PIN, LOW);
      delay(1); // Give the OpenMV Cam some time to setup to send data.

      if (SPI.transfer(1) == 85) { // saw sync char?
      SPI.transfer(&temp, 4); // get length
      int zero_legnth = 4 + ((temp + 1) % 4);
      if (temp) {
      SPI.transfer(&buff, min(temp, CHAR_BUF));
      temp -= min(temp, CHAR_BUF);
      }
      while (temp--) SPI.transfer(0); // eat any remaining bytes
      while (zero_legnth--) SPI.transfer(0); // eat zeros.
      }

      digitalWrite(SS_PIN, HIGH);
      Serial.print(buff);
      delay(1); // Don't loop to quickly.
      }

      sketch_jan03a.ino: In function 'void loop()':
      sketch_jan03a:23: error: no matching function for call to 'SPIClass::transfer(int32_t*&, int)'
      D:\360Downloads\Arduino\libraries\SPI/SPI.h:55: note: candidates are: static byte SPIClass::transfer(byte)
      sketch_jan03a:24: error: invalid operands of types 'int32_t*' and 'int' to binary 'operator%'
      sketch_jan03a:26: error: ISO C++ forbids comparison between pointer and integer
      sketch_jan03a:26: error: operands to ?: have different types 'int32_t*' and 'int'
      sketch_jan03a:27: error: ISO C++ forbids comparison between pointer and integer
      sketch_jan03a:27: error: operands to ?: have different types 'int32_t*' and 'int'

      发布在 OpenMV Cam
      G
      gd3p
    • WiFi模板与电脑连接时,WiFi受限制怎么办

      WiFi模板与电脑连接时,WiFi受限制怎么办

      发布在 OpenMV Cam
      G
      gd3p
    • RE: AttributeError: 'tuple' object has no attribute 'cx'

      @kidswong999 谢谢

      发布在 OpenMV Cam
      G
      gd3p
    • 模板匹配时要求模板有大小需求吗?有的话,要求多大呢?

      模板匹配时要求模板有大小需求吗?有的话,要求多大呢?

      发布在 OpenMV Cam
      G
      gd3p
    • RE: AttributeError: 'tuple' object has no attribute 'cx'

      @kidswong999 新买的

      发布在 OpenMV Cam
      G
      gd3p