Go Down

Topic: Mowayduino and nrf24l01 communication (Read 1 time) previous topic - next topic

sistemasorp

May 22, 2014, 11:32 pm Last Edit: May 22, 2014, 11:34 pm by sistemasorp Reason: 1
Is there anybody that can communicate mowayduino robot ( http://moway-robot.com/en/mowayduino/que-es/ ) with nrf24l01  and Mirf library?

I have two parts: the mowayduino sending one string and an arduino uno with a nrf24l01 module receiving that string.

The source code for both is very simple:

MowayDuino:
Code: [Select]

#include "MowayduinoRobot.h"
#include <SPI.h>
#include <EEPROM.h>

mowayduinorobot robot;
unsigned char datos[8];

void RfDataReady();
void RfDataReady()
{}

void setup()
{
 robot.beginMowayduino();
 robot.beginRF(2,0x10);
 robot.On();
 datos[0] = 100;
 datos[1] = 101;
 datos[2] = 102;
 datos[3] = 103;
 datos[4] = 104;
 datos[5] = 105;
 datos[6] = 106;
 datos[7] = 107;
 delay(2000);
}

void loop()
{
   robot.Blueon();
   delay(500);
   if(robot.Send(0x20,datos) == 0)
   {
     robot.Blueoff();
     robot.Greenon();
     delay(500);
     robot.Greenoff();
   }
   else
   {
     robot.Blueoff();
     robot.Redon();
     delay(500);
     robot.Redoff();
   }
}


Arduino UNO:
Code: [Select]

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

byte direccion[] = {0x20, 0xc2, 0xc2, 0xc2, 0xc2};

void setup(){
 Serial.begin(9600);
 Mirf.spi = &MirfHardwareSpi;
 Mirf.init();
 Mirf.setRADDR(direccion);
  Mirf.payload = 10;
 Mirf.channel = 2;
 Mirf.config();
 Serial.println("Listening...");
}

void loop(){
 int indice;
 byte data[Mirf.payload];
 
 if(!Mirf.isSending() && Mirf.dataReady()){
   Serial.println("Got packet");
   
   Mirf.getData(data);
   for(indice = 0; indice < Mirf.payload; indice++) Serial.print((char)data[indice]);
   Serial.println();
 }
}


After several tests I only receive the string sometimes (with a long time between receptions) and I don't know what more I have to do to achieve a real communication. The connections in Arduino UNO are correct because I can receive the string from another pair of arduino and nrf24l01 .

Go Up