serialMode errore

Ciao a tutti,
sono nuovo del forum

ho acquistato questo modulo:
http://www.robot-italy.com/product_info.php?products_id=2083

e nel wiki: http://www.seeedstudio.com/wiki/index.php?title=Relay_Shield

con relativa documentazione di test: http://www.seeedstudio.com/wiki/images/6/66/RFBee_v1_1_for_RelayShield.zip

questo è lo sketch di prova:

//  Firmware for controling the remote relay shield 
//  see www.seeedstudio.com for details and ordering rfBee hardware.

//  Copyright (c) 2010 Hans Klunder <hans.klunder (at) bigfoot.com>
//  Author: Hans Klunder, based on the original Rfbee v1.0 firmware by Seeedstudio
//  Version: July 14, 2010
//
//  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
//  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//  See the GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License along with this program; 
//  if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA



//#define FIRMWAREVERSION 11 // 1.1  , version number needs to fit in byte (0~255) to be able to store it into config
//#define FACTORY_SELFTEST
//#define DEBUG 

#include <avr/pgmspace.h>
#include <EEPROM.h>
#include "debug.h"
#include "globals.h"
#include "Config.h"
#include "CCx.h"
#include "rfBeeSerial.h"
#include "rfBeeCore.h"

#ifdef FACTORY_SELFTEST
#include <TestIO.h>  // factory selftest
#endif

#define GDO0 2 // used for polling the RF received data


//command used for controlling the remote relay shield,
//and different commands will be sent in interval in the loop
//command format:"RCXY"
//RC-command head
//X-which relay to be contorlled,X could be '0'-relay1,'1'-relay2, ... 'A'-relay11,'B'-relay12,(0-3 for group1, 4-8(controlled from Hub1) for group2, 9-B(controlled from Hub2) for group3)
//Y-which state the relay is to be set,Y could be '0'-set relay NO pin open,'1'-set realy NO pin close
//Note: This is just an demo on how to use RFBee in pair, and you can define your own commands.

byte relayCmd[4] = {'R','C','0','1'};


//=======================================================================
void setup(){
    if (Config.initialized() != OK) 
    {
      Serial.begin(9600);
      Serial.println("Initializing config"); 
#ifdef FACTORY_SELFTEST
      if ( TestIO() != OK ) 
        return;
#endif 
      Config.reset();
    }
    setUartBaudRate();
    rfBeeInit();
    Serial.println("ok");
}
//----------------------------------------------------------------------------------------
void loop(){

  //send cmmands to remote RFBee to control the relayshield in interval of 1s
  controlRemoteRelayShield();
  
  if (Serial.available() > 0){
    sleepCounter=1000; // reset the sleep counter
    if (serialMode == SERIALCMDMODE)
      readSerialCmd();
    else
      readSerialData();
  }
  
  if ( digitalRead(GDO0) == HIGH ) {
      writeSerialData();
      sleepCounter++; // delay sleep
  }
  sleepCounter--;
  
  // check if we can go to sleep again, going into low power too early will result in lost data in the CCx fifo.
  if ((sleepCounter == 0) && (Config.get(CONFIG_RFBEE_MODE) == LOWPOWER_MODE))
    DEBUGPRINT("low power on")
    lowPowerOn();
    DEBUGPRINT("woke up")
}
//===========================================================================================================

void rfBeeInit(){
    DEBUGPRINT()
    
    CCx.PowerOnStartUp();
    setCCxConfig();
   
    serialMode=SERIALDATAMODE;
    sleepCounter=0;
    
    attachInterrupt(0, ISRVreceiveData, RISING);  //GD00 is located on pin 2, which results in INT 0

    pinMode(GDO0,INPUT);// used for polling the RF received data

}

// handle interrupt
void ISRVreceiveData(){
  //DEBUGPRINT()
  sleepCounter=10;
}

//send cmmands to remote RFBee to control the relayshield in interval of 1s
void controlRemoteRelayShield()
{
	//byte sendBuf[60];
	//set group1 to group3 (relay 1~12)on or off
	static char OnOff = 0;
	OnOff = 1 - OnOff;
	relayCmd[3] = OnOff + '0';
	
  for(int i = 0; i < 12; i++){
  	if(i > 9){
  		relayCmd[2] = i - 10 + 'A';
  	}
  	else{
  		relayCmd[2] = i + '0';
  		//memcpy(sendBuf+4*i,relayCmd,4);
  	}
    transmitData(relayCmd,4,Config.get(CONFIG_MY_ADDR),Config.get(CONFIG_DEST_ADDR));
    //delay(1000);
  }
  delay(1000);
 
}

solo che l’IDE se ne esce con l’errore:

’serialMode’ was not declared in thi scope

come posso risolvere?

Allego errore completo:

In file included from RFBee_Master.cpp:28:
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/Config.h:51: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/Config.h:52: error: 'byte' has not been declared
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/Config.h:52: error: 'byte' has not been declared
In file included from RFBee_Master.cpp:29:
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:129: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:130: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:131: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:132: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:133: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:139: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:140: error: 'byte' has not been declared
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:143: error: 'byte' has not been declared
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:143: error: 'byte' has not been declared
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:145: error: 'byte' has not been declared
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/CCx.h:147: error: 'byte' does not name a type
In file included from RFBee_Master.cpp:30:
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:56: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:57: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:87: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:88: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:89: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:90: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: too many initializers for 'AT_Command_t'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:117: error: invalid conversion from 'int' to 'int (*)()'
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeSerial.h:120: error: 'byte' does not name a type
In file included from RFBee_Master.cpp:31:
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:34: error: variable or field 'transmitData' declared void
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:34: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:34: error: 'txData' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:34: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:34: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:34: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'rxData' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'len' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'srcAddress' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'destAddress' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'rssi' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'byte' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: 'lqi' was not declared in this scope
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:35: error: initializer expression list treated as compound expression
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:36: error: 'byte' does not name a type
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:37: error: variable or field 'sleepNow' declared void
C:\arduino-1.0\libraries\RFBee_v1_1_for_RelayShield/rfBeeCore.h:37: error: 'byte' was not declared in this scope
RFBee_Master.cpp: In function 'void loop()':
RFBee_Master.pde:-1: error: 'serialMode' was not declared in this scope
RFBee_Master.pde:-1: error: 'class CONFIG' has no member named 'get'
RFBee_Master.cpp: In function 'void rfBeeInit()':
RFBee_Master.pde:-1: error: 'serialMode' was not declared in this scope
RFBee_Master.cpp: In function 'void controlRemoteRelayShield()':
RFBee_Master.pde:-1: error: 'class CONFIG' has no member named 'get'
RFBee_Master.pde:-1: error: 'class CONFIG' has no member named 'get'
RFBee_Master.pde:-1: error: 'transmitData' was not declared in this scope

nessuno saprebbe aiutarmi?

Prova a compilare con l'IDE 0023 --> Previous IDE Versions --> http://arduino.cc/en/Main/Software La libreria potrebbe essere non aggiornata.

EDIT: Nel file Config.h viene richiamato solo:

include "WProgram.h"

Credo che sia la libreria non aggiornata. Tra l'altro è un guazzabuglio di file. :fearful:

grazie mille per la risposta... infatti ho provato con il 0023 e ottengo lo stesso errore...

altre idee su come provare? xke se no non saprei proprio come usare la scheda non avendo nemmeno un esempio funzionante

max95:
altre idee su come provare? xke se no non saprei proprio come usare la scheda non avendo nemmeno un esempio funzionante

Il software che hai scaricato è quello per comandare la scheda tramite Xbee, richiede l’inserimento di varie librerie tra quelle di Arduino per essere compilato.
Scarica l’esempio di base, senza utilizzo del modulo Xbee e vedrai che non hai problemi a compilarlo e far funzionare la shield, in pratica devi solo settare lo stato dei pin 4-5-6-7 per azionare i relè.

Questo è lo sketch di esempio per i relè:

//  RelayShieldDemoCode.pde  to control seeed relay shield by arduino.
//  Copyright (c) 2010 seeed technology inc.
//  Author: Steve Chang
//  Version: september 2, 2010
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

unsigned char relayPin[4] = {4,5,6,7};

void setup()
{
  int i;
  for(i = 0; i < 4; i++)
  {
    pinMode(relayPin[i],OUTPUT);
  }
}

//just an simple demo to close and open 4 relays
// every other 1s.
void loop()
{

  int i=0;
  for(i = 0; i < 4; i++)
  {
    digitalWrite(relayPin[i],HIGH);
  }
  delay(1000);
  for(i = 0; i < 4; i++)
  {
    digitalWrite(relayPin[i],LOW);
  } 
  delay(1000);
  
}

Ho modificato tutti i file della libreria sostituendo a WProgram.h Arduino.h.
Adesso con l’IDE 1.0 compila, ma non so se funziona perché non ho la scheda relè.
Provala.
Allego il file. :smiley:

RFBee_v1_1_for_RelayShield-IDE10.zip (48.2 KB)

yeah grazie mille!!!!... ora compila e carica il programma... solo che i due xbee non si vedono... 8)

Mi spiace ma questo è l’unico Bee che conosco.

Bee-sama!

YO!!

PaoloP: Mi spiace ma questo è l'unico Bee che conosco.

Bee-sama!

Io preferisco "ero sennin" :grin:

@astrobeed :stuck_out_tongue_closed_eyes: maniaco :stuck_out_tongue_closed_eyes: