Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arduino 远程控制直升机的采集协议_Arduino_Remote Control_Infrared - Fatal编程技术网

Arduino 远程控制直升机的采集协议

Arduino 远程控制直升机的采集协议,arduino,remote-control,infrared,Arduino,Remote Control,Infrared,我有一架(S107G)迷你直升机和一架Arduino。这些可能性听起来很有趣。所以我开始寻找从控制器到直升机的红外数据传输协议。我用这段代码试图找出其中的一些东西 void setup() { Serial.begin(9600); pinMode(12, INPUT_PULLUP); // 12 is IR sensor } void loop() { Serial.print(digitalRead(12) ? LOW : HIGH); delay(1);

我有一架(S107G)迷你直升机和一架Arduino。这些可能性听起来很有趣。所以我开始寻找从控制器到直升机的红外数据传输协议。我用这段代码试图找出其中的一些东西

void setup()
{
    Serial.begin(9600);
    pinMode(12, INPUT_PULLUP); // 12 is IR sensor
}

void loop()
{
    Serial.print(digitalRead(12) ? LOW : HIGH);
    delay(1);
}
显然,这有很多缺陷

  • 延迟(1)
    是任意选择的,我无法知道数据以什么速度传输
  • 它可以是模拟输入。(尽管我对此表示怀疑,因为我发现的大多数红外传感器都不支持这一点)
  • 我无法知道“包”何时开始或结束
  • 如果你们有人知道怎么做的话 我将不胜感激。谢谢


    编辑:我找到了,听起来很不错,但他没有深入了解他是如何做到的,以及他的发现是什么(速度等)。

    你可以找到完整的代码库,在其中你可以找到irsendDemo直升机.ino和IRrecvDump.ino的示例。这些和IRremote.cpp应该可以回答您的问题。我的计划(已经有一段时间)是在Esplora上安装发射机

    以下是微秒,可在

    这是R3和R5的位模式。我相信R5是生产中最常见的产品

    union helicopter {
      uint32_t dword;
      struct
      {
         uint8_t Throttle  : 7;    //  0..6   0 - 127
         uint8_t Channel   : 1;    //  7      A=0, B=1
         uint8_t Pitch     : 7;    //  8..14  0(forward) - 63(center) 127(back)
         uint8_t Pspacer   : 1;    // 15      na
         uint8_t Yaw       : 7;    // 16..22  127(left) - 63(center) - 0(right)
      } symaR3;
      struct
      {
         uint8_t Trim      : 7;    //  0..6  127(left) - 63(center) - 0(right)
         uint8_t Tspacer   : 1;    //  7     na
         uint8_t Throttle  : 7;    //  8..14 0 - 127
         uint8_t Channel   : 1;    // 15     A=0, B=1
         uint8_t Pitch     : 7;    // 16..22 0(forward) - 63(center) 127(back)
         uint8_t Pspacer   : 1;    // 23     na
         uint8_t Yaw       : 7;    // 24..30 127(left) - 63(center) - 0(right)
      } symaR5;
    };
    

    但他们总是有可能推出一种新的模式。

    哇!非常感谢你!我不知道有人会给出这么好的答案!我一到家就去看看!
    union helicopter {
      uint32_t dword;
      struct
      {
         uint8_t Throttle  : 7;    //  0..6   0 - 127
         uint8_t Channel   : 1;    //  7      A=0, B=1
         uint8_t Pitch     : 7;    //  8..14  0(forward) - 63(center) 127(back)
         uint8_t Pspacer   : 1;    // 15      na
         uint8_t Yaw       : 7;    // 16..22  127(left) - 63(center) - 0(right)
      } symaR3;
      struct
      {
         uint8_t Trim      : 7;    //  0..6  127(left) - 63(center) - 0(right)
         uint8_t Tspacer   : 1;    //  7     na
         uint8_t Throttle  : 7;    //  8..14 0 - 127
         uint8_t Channel   : 1;    // 15     A=0, B=1
         uint8_t Pitch     : 7;    // 16..22 0(forward) - 63(center) 127(back)
         uint8_t Pspacer   : 1;    // 23     na
         uint8_t Yaw       : 7;    // 24..30 127(left) - 63(center) - 0(right)
      } symaR5;
    };