Guillaume wrote:At least show your code so we can see where you are stuck at.
Iwant just to play tone when switch On or OFF
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__SOFTSERIAL
#include <SoftwareSerial.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL_RX 0
#define REMOTEXY_SERIAL_TX 1
#define REMOTEXY_SERIAL_SPEED 9600
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,8,0,0,0,139,0,6,5,1,
2,0,4,4,20,7,2,79,78,0,
79,70,70,0,2,0,4,14,20,7,
2,79,78,0,79,70,70,0,2,0,
4,24,20,7,2,79,78,0,79,70,
70,0,2,0,4,34,20,7,2,79,
78,0,79,70,70,0,2,0,4,44,
20,7,2,79,78,0,79,70,70,0,
2,0,4,54,20,7,2,79,78,0,
79,70,70,0,2,0,4,64,20,7,
2,79,78,0,79,70,70,0,2,0,
4,74,20,7,2,79,78,0,79,70,
70,0,129,0,28,5,18,5,0,82,
111,111,109,32,78,111,46,49,0,130,
0,27,4,29,6,8 };
// this structure defines all the variables of your control interface
struct {
// input variable
uint8_t switch_2; // =1 if switch ON and =0 if OFF
uint8_t switch_3; // =1 if switch ON and =0 if OFF
uint8_t switch_4; // =1 if switch ON and =0 if OFF
uint8_t switch_5; // =1 if switch ON and =0 if OFF
uint8_t switch_6; // =1 if switch ON and =0 if OFF
uint8_t switch_7; // =1 if switch ON and =0 if OFF
uint8_t switch_8; // =1 if switch ON and =0 if OFF
uint8_t switch_9; // =1 if switch ON and =0 if OFF
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_SWITCH_2 2
#define PIN_SWITCH_3 3
#define PIN_SWITCH_4 4
#define PIN_SWITCH_5 5
#define PIN_SWITCH_6 6
#define PIN_SWITCH_7 7
#define PIN_SWITCH_8 8
#define PIN_SWITCH_9 9
void setup()
{
RemoteXY_Init ();
pinMode (PIN_SWITCH_2, OUTPUT);
pinMode (PIN_SWITCH_3, OUTPUT);
pinMode (PIN_SWITCH_4, OUTPUT);
pinMode (PIN_SWITCH_5, OUTPUT);
pinMode (PIN_SWITCH_6, OUTPUT);
pinMode (PIN_SWITCH_7, OUTPUT);
pinMode (PIN_SWITCH_8, OUTPUT);
pinMode (PIN_SWITCH_9, OUTPUT);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_SWITCH_2, (RemoteXY.switch_2==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_3, (RemoteXY.switch_3==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_4, (RemoteXY.switch_4==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_5, (RemoteXY.switch_5==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_6, (RemoteXY.switch_6==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_7, (RemoteXY.switch_7==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_8, (RemoteXY.switch_8==0)?HIGH:LOW);
digitalWrite(PIN_SWITCH_9, (RemoteXY.switch_9==0)?HIGH:LOW);
// TODO you loop code
// use the RemoteXY structure for data transfer
}