极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: mylife1213

认真的nrf24l01库 5路接收通道 2月6号_更新用户模式选择

  [复制链接]
 楼主| 发表于 2015-2-8 13:42:30 | 显示全部楼层
huan 发表于 2015-2-8 13:21
我的编译会出现D:\arduino-1.5.2-windows\arduino-1.5.2\libraries\nrf24l01\Multiple.cpp: In member func ...

麻烦说下是用了那个例程,还有用的是那个arduino的硬件,库下的是版本号为v1.1的吗
回复 支持 反对

使用道具 举报

发表于 2015-2-8 13:47:42 | 显示全部楼层
mylife1213 发表于 2015-2-8 13:42
麻烦说下是用了那个例程,还有用的是那个arduino的硬件,库下的是版本号为v1.1的吗


刚下的库,arduino uno r3 编译器是1.5.2,里面带的几个例程都会,谢谢
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-8 13:58:37 | 显示全部楼层
huan 发表于 2015-2-8 13:47
刚下的库,arduino uno r3 编译器是1.5.2,里面带的几个例程都会,谢谢

我刚才使用arduino 1.5.8试过了,没有出现错误提示,你试一下去下载新版来试一下 http://arduino.cc/download.php?f=/arduino-1.5.8-windows.zip 这是下载地址
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-8 14:11:26 | 显示全部楼层
本帖最后由 mylife1213 于 2015-2-8 14:22 编辑
leicheng 发表于 2015-2-8 13:31
或许是底层硬件搞多了,还是没跳出来,你以为是玩uscos吗~
我说的其他改进建议是在windows/android上开 ...


懂你说的了,你是想让我加入跳频协议吧
回复 支持 反对

使用道具 举报

发表于 2015-2-8 14:41:06 | 显示全部楼层
mylife1213 发表于 2015-2-8 13:58
我刚才使用arduino 1.5.8试过了,没有出现错误提示,你试一下去下载新版来试一下 http://arduino.cc/down ...


使用1.5.8已经可以正常编译下载了,感谢
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-8 15:07:40 | 显示全部楼层
huan 发表于 2015-2-8 14:41
使用1.5.8已经可以正常编译下载了,感谢

不客气,;;;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-8 16:40:30 | 显示全部楼层
leicheng 发表于 2015-2-8 13:31
或许是底层硬件搞多了,还是没跳出来,你以为是玩uscos吗~
我说的其他改进建议是在windows/android上开 ...

对于一个多路通信如果引入跳频信道的话只会增加线路的不稳定性,而且设计难度太大。单路引入跳频通信实现简单,只要在发送的时候检测是否发送信道CD寄存器是否置位,如果是的话就在数据中加入下次通信的信道,接收端只要收到数据中存在改变信道的数据那么就马上切换信道。5路通信的跳频还是请专门研究通信协议的专家来解决吧
回复 支持 反对

使用道具 举报

发表于 2015-3-13 22:08:59 | 显示全部楼层
发送端TX地址为0x03,为什么结果显示接收端通道为0?应该为第3通道呀?
回复 支持 反对

使用道具 举报

发表于 2015-4-20 23:26:31 | 显示全部楼层
我把spi_send的文件下载在多个arduino控制器, 一个接受,发现可行,但是都是channel 0,当我发射端用Nrf.set_reg("Channel","1")时,接收端就就接受不到信息,是不是接收端也要这样设置? 但是我发射端,接收端都设置了,还是接受不到信息。。。。。
回复 支持 反对

使用道具 举报

发表于 2015-5-31 11:04:31 | 显示全部楼层
想控制六路继电器该怎么实现?想用DHT11发送温湿度数据又该怎么实现?
回复 支持 反对

使用道具 举报

发表于 2015-5-31 11:09:22 | 显示全部楼层
glmyc 发表于 2014-12-15 21:18
这个是好东东,用一个MINI PRO做一个室外天气测量装置
通过空气质量传感器、温湿度传感器、雨水传感器、光 ...

怎么弄?只要发送DHT11温湿度数据就好了
回复 支持 反对

使用道具 举报

发表于 2015-5-31 11:16:09 | 显示全部楼层
mega2560作为主机连接W5100接上网线通过yeelink发送六路开关信号到从机,怎么实现

  1. /*
  2. Yeelink sensor client power switch example
  3. */

  4. #include <SPI.h>
  5. #include <Ethernet.h>
  6. #include <Wire.h>
  7. #include <math.h>

  8. byte buff[2];



  9. // for yeelink apiapi.yeelink.net      LED    /v1.0/device/10964/sensor/18179/datapoints
  10. #define APIKEY         "47412e01ab744a131cb8da0e64d7e040" // 此处替换为你自己的API KEY
  11. #define DEVICEID       10964 // 此处替换为你的设备编号

  12. char flag =0;  //定义开关循环控制变量

  13. //#define SENSORID1      19581 // 此处替换为你的传感器编号
  14. //#define SENSORID2      19582

  15. String SENSORID[]={"19581","19582"}; // 把sensor ID 依次替在这里,程序定义为数组,几个开关就写几个

  16. byte ledPin[]={5,6};



  17. // assign a MAC address for the ethernet controller.
  18. byte mac[] = { 0x00, 0x1D, 0x72, 0x82, 0x35, 0x9D};
  19. // initialize the library instance:
  20. EthernetClient client ;
  21. char server[] = "api.yeelink.net";   // name address for yeelink API

  22. unsigned long lastConnectionTime = 0;          // last time you connected to the server, in milliseconds
  23. boolean lastConnected = false;                 // state of the connection last time through the main loop
  24. const unsigned long postingInterval = 3*1000; // delay between 2 datapoints, 30s
  25. String returnValue = "";
  26. boolean ResponseBegin = false;

  27. void setup() {

  28.   pinMode(5, OUTPUT);
  29.   pinMode(6, OUTPUT);
  30.    
  31. for(int i=0;i<2;i++)       //I<7,几个开关,就把7改成几,其实就是循次数
  32. { pinMode(ledPin[i],OUTPUT);}



  33.   Wire.begin();
  34.   
  35.   // start serial port:
  36. Serial.begin(57600);
  37.   
  38.   // start the Ethernet connection with DHCP:
  39.   if (Ethernet.begin(mac) == 0) {
  40.     Serial.println("Failed to configure Ethernet using DHCP");
  41.     for(;;)
  42.       ;
  43.   }
  44.   else {
  45.     Serial.println("Ethernet configuration OK");
  46.   }
  47. }

  48. void loop() {
  49.   // if there's incoming data from the net connection.
  50.   // send it out the serial port.  This is for debugging
  51.   // purposes only:

  52.   if (client.available()) {
  53.     char c = client.read();
  54.    // Serial.print(c);
  55.       if (c == '{')
  56.         ResponseBegin = true;
  57.       else if (c == '}')
  58.         ResponseBegin = false;

  59.       if (ResponseBegin)
  60.         returnValue += c;   
  61.   }
  62.   if (returnValue.length() !=0 && (ResponseBegin == false))
  63.   {
  64.     Serial.println(returnValue);
  65.    
  66.     if (returnValue.charAt(returnValue.length() - 1) == '1') {
  67.       Serial.println("turn on the LED");
  68.       
  69.       
  70.       digitalWrite(ledPin[flag], HIGH);
  71.       
  72.       
  73.     }
  74.       else if(returnValue.charAt(returnValue.length() - 1) == '0') {
  75.       Serial.println("turn off the LED");
  76.       digitalWrite(ledPin[flag], LOW);
  77.     }
  78.      returnValue = "";
  79.      flag++;
  80.   }
  81.   
  82.   
  83.   // if there's no net connection, but there was one last time
  84.   // through the loop, then stop the client:
  85.   if (!client.connected() && lastConnected) {
  86.     Serial.println();
  87.     Serial.println("disconnecting.");
  88.     client.stop();
  89.   }
  90.   
  91.   // if you're not connected, and ten seconds have passed since
  92.   // your last connection, then connect again and send data:
  93.   
  94.   
  95.   if(!client.connected() && (millis() - lastConnectionTime > postingInterval)) {
  96.     // read sensor data, replace with your code
  97.     //int sensorReading = readLightSensor();
  98.     Serial.print("yeelink:");
  99.     //get data from server  
  100.    // getData();
  101.    
  102.                  
  103.                  if (flag<2)
  104.                 {
  105.                   //get data from server
  106.                   getData();   
  107.                 }
  108.                 else
  109.               {
  110.                   //put data to server

  111.                   if(flag=3) {flag =0;}
  112.                 }


  113.    
  114.   }
  115.   
  116.   // store the state of the connection for next time through
  117.   // the loop:
  118.   lastConnected = client.connected();
  119. }







  120. // this method makes a HTTP connection to the server and get data back
  121. void getData(void) {
  122.   // if there's a successful connection:
  123.   if (client.connect(server, 80)) {
  124.     Serial.println("connecting...");
  125.     // send the HTTP GET request:
  126.    
  127.     client.print("GET /v1.0/device/");
  128.     client.print(DEVICEID);
  129.     client.print("/sensor/");
  130.     //client.print(SENSORID2);
  131.     //SENSORID[flag]={"19581","19582"};
  132.     client.print(SENSORID[flag]);
  133.     client.print("/datapoints");
  134.     client.println(" HTTP/1.1");
  135.     client.println("Host: api.yeelink.net");
  136.     client.print("Accept: *");
  137.     client.print("/");
  138.     client.println("*");
  139.     client.print("U-ApiKey: ");
  140.     client.println(APIKEY);
  141.     client.println("Content-Length: 0");
  142.     client.println("Connection: close");
  143.     client.println();
  144.     Serial.println("print get done.");
  145.    
  146.   }
  147.   else {
  148.     // if you couldn't make a connection:
  149.     Serial.println("connection failed");
  150.     Serial.println();
  151.     Serial.println("disconnecting.");
  152.     client.stop();
  153.   }
  154.    // note the time that the connection was made or attempted:
  155.   lastConnectionTime = millis();

复制代码
怎么插入24l01的代码来控制从机?
回复 支持 反对

使用道具 举报

发表于 2015-9-2 10:08:38 | 显示全部楼层
楼主,这个Arduino uno 的中断应该用的是哪个引脚啊?
回复 支持 反对

使用道具 举报

发表于 2015-9-22 16:35:40 | 显示全部楼层
似乎有点小bug:
(1)Interrup_read(uint8_t channel,uint8_t* data)好像应该是Interrup_read(uint8_t &channel,uint8_t* data)
(2)rx_addr_p2_5[6],这个数组貌似第一位还是通道1的地址,修改成rx_addr_p2_5[6]={0x01,0x02,0x03,0x04,0x05}就对了。
其它还在测试中,总而言之,非常感谢楼主的无私奉献,节省了我等大量时间
回复 支持 反对

使用道具 举报

发表于 2015-11-24 14:56:07 | 显示全部楼层
感谢楼主的无私奉献,赞楼主的开源精神!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-26 23:13 , Processed in 0.048494 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表