Arduino Yun Server

Hi, I am trying to show in web page using the Arduino Yun the data receive by a module RF. When I introduce the code to program the server the function that receive the data by the module RF never works. Could someone help me?

Here is the code I introduce in the arduino

#include <SoftwareSerial.h>
#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>

YunServer server;

#define BAUD_RATE       1200        // Tasa de transmision

// Definicion de bytes para el protocolo
#define BYTE_SINC       0xAA    // Byte de sincronia
#define BYTE_INICIO     0x7E    // Byte delimitador de inicio
#define BYTE_DIR_RX     0x01    // Dirección asignada al nodo receptor
#define TAM_TRAMA       4       // Cantidad de bytes en una trama
#define LED             6

int direc, dato,Recep;
SoftwareSerial moduloRF = SoftwareSerial(9,10);

/* Declaracion de funciones */
void Recibir();    //Funcion de recepcion serial

void setup(void)



void loop(void)
  Recibir();       // Funcion de recepcion
  YunClient client = server.accept();

  if (client) {
    String command = client.readString();
    if (command == "temperature") {
     int val = dato;


void Recibir()

  // Ejecutar solo si se recibieron la cantidad minima de caracteres por trama
  if (moduloRF.available() >= TAM_TRAMA)
    // Buscar un byte de inicio, si se lo encuentra procesar los bytes
    // siguientes (son parte de la trama)
    if ( == BYTE_INICIO)
      direc =; // Leer el byte de direccion
      // Verificar que la trama este dirigida a nosotros
      if (direc == BYTE_DIR_RX)
        dato =;    // Leer el byte de datos
        if ( == (direc + dato))  // Verificar el checksum

Here is the code html of the server

<!DOCTYPE html>
    <script type="text/javascript" src="zepto.min.js"></script>
    <script type="text/javascript">
        function refresh() {
<body onload="setInterval(refresh, 1000);">
    <span id="content">Waiting for Arduino...</span>


nobody knows what is the problem?

Have patience. That half of the world may be in bed. Or in the pub.


I would add some Serial.println() statements in key locations, and then see what output you are getting in the serial monitor.

For example, after the if (client) statement, print out that a client was found. Then, print out again after the client.readstring() call. That will let you know if the read operation is causing the sketch to hang.

Then, in the Recibir() function, print out that you have entered the function, and also inside each of the IF blocks.

The first step is to figure out of the sketch is hanging up somewhere, or simply not executing the block of code that you would expect.