从遥控直升机收集协议 [英] Gathering protocol from remote control helicopter

查看:300
本文介绍了从遥控直升机收集协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(S107G)迷你直升机,和一个Arduino。这种可能性听起来很有趣。于是我动身去寻找数据从控制器转移与IR直升机的协议。我用这个code,试图弄清楚它的东西。

I have a (S107G) mini helicopter, and an Arduino. The possibilities sounded quite fun. So I set off to find the protocol for the transfer of data from controller to helicopter with IR. I used this code to try to figure out something of it.

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

void loop()
{
    Serial.print(digitalRead(12) ? LOW : HIGH);
    delay(1);
}

显然有许多漏洞与此有关。

Obviously there a number of flaws with this.


  1. 延迟(1); 是任意选择的,我不知道在传输什么高速数据的方式

  2. 这可能是模拟输入。 (虽然我对此表示怀疑,因为大多数红外传感器,我发现不支持)

  3. 我不知道什么时候一个数据包开始或结束的方式。

  1. delay(1); is arbitrarily chosen, I have no way of knowing at what speed data is transmitted.
  2. It could be an analog input. (Though I doubt it, as most IR sensors I found don't support that)
  3. I have no way of knowing when a "packet" starts or ends.

如果您有任何的如何做到这一点的想法
我更AP preciate它。谢谢!

If any of you have an idea of how to do this I would much appreciate it. Thanks!

编辑:我发现<一个href=\"http://stackoverflow.com/questions/14774794/how-to-determine-checksum-from-de$c$cd-ir-remotes\">this在SO ,听起来很不错,但他并没有进入深度来他是如何做到的,什么他的调查结果(速度等)

I found this on SO and it sounds very nice, but he didn't go into depth as to how he did it, and what his findings were (speed, etc.)

推荐答案

您可以找到完整的code库的在这里我github上中,你会发现IRsendDemoHelicopter.ino和IRrecvDump.ino的例子。这些和IRremote.cpp应该回答你的问题。我有它在我的计划(的某个时候),以实现在一个Esplora发射器。

You can find the complete code library here on my GITHUB in which you will find the examples of IRsendDemoHelicopter.ino and IRrecvDump.ino. These and the IRremote.cpp should answer your questions. I have had it on my plan (for sometime) to implement the transmitter on an Esplora.

下面是微秒,在发现的https:// github.com/mpflaga/Arduino-IRremote/blob/master/IRremoteInt.h#L192

#define SYMA_UPDATE_PERIOD_CH_A 120 // 0
#define SYMA_UPDATE_PERIOD_CH_B 180 // 1
#define SYMA_HDR_MARK 2000
#define SYMA_HDR_SPACE 2000
#define SYMA_BIT_MARK 320
#define SYMA_ONE_SPACE 687
#define SYMA_ZERO_SPACE 300

和这里为两个R3和R5的比特的图案。我相信R5是生产中最常见的是。

and here is the pattern of bits for both the R3 and R5. I believe the R5 is the most common being in production.

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;
};

但它始终是可能的,他们推出了一个新的模式。

but it is always possible they have come out with a new pattern.

这篇关于从遥控直升机收集协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆