I'm a Noob, please help
I'm using remotexy, I have 10 buttons that will control 8 relays, I'm trying to figure out how to control combination of 2 pin output for every button that is press, for example button 1, when press would set pin out 2 and 4 HIGH and button 2 would, when press would set pin out 1 and 8 HIGH. When buttons are release the pin out would return to LOW.
here is my code
/*
-- project2 --
This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.3.3 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- for ANDROID 4.1.1 or later version;
- for iOS 1.2.1 or later version;
This source code 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.
*/
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__HARDSERIAL
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 9600
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,9,0,0,0,94,0,8,13,0,
1,0,13,6,12,12,2,31,49,0,
1,0,29,6,12,12,2,31,50,0,
1,0,58,6,12,12,2,31,52,0,
1,0,44,6,12,12,2,31,51,0,
1,0,74,7,12,12,2,31,53,0,
1,0,13,24,12,12,2,31,55,0,
1,0,30,24,12,12,2,31,56,0,
1,0,45,24,12,12,2,31,57,0,
1,0,61,24,12,12,2,31,49,48,
0 };
// this structure defines all the variables of your control interface
struct {
// input variable
uint8_t button_1; // =1 if button pressed, else =0
uint8_t button_2; // =1 if button pressed, else =0
uint8_t button_3; // =1 if button pressed, else =0
uint8_t button_4; // =1 if button pressed, else =0
uint8_t button_5; // =1 if button pressed, else =0
uint8_t button_6; // =1 if button pressed, else =0
uint8_t button_7; // =1 if button pressed, else =0
uint8_t button_8; // =1 if button pressed, else =0
uint8_t button_9; // =1 if button pressed, else =0
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_BUTTON_1 2
#define PIN_BUTTON_2 3
#define PIN_BUTTON_3 4
#define PIN_BUTTON_4 5
#define PIN_BUTTON_5 6
#define PIN_BUTTON_6 7
#define PIN_BUTTON_7 8
#define PIN_BUTTON_8 9
#define PIN_BUTTON_9 10
void setup()
{
RemoteXY_Init ();
pinMode (PIN_BUTTON_1, OUTPUT);
pinMode (PIN_BUTTON_2, OUTPUT);
pinMode (PIN_BUTTON_3, OUTPUT);
pinMode (PIN_BUTTON_4, OUTPUT);
pinMode (PIN_BUTTON_5, OUTPUT);
pinMode (PIN_BUTTON_6, OUTPUT);
pinMode (PIN_BUTTON_7, OUTPUT);
pinMode (PIN_BUTTON_8, OUTPUT);
pinMode (PIN_BUTTON_9, OUTPUT);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_2, (RemoteXY.button_2==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_3, (RemoteXY.button_3==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_4, (RemoteXY.button_4==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_5, (RemoteXY.button_5==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_6, (RemoteXY.button_6==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_7, (RemoteXY.button_7==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_8, (RemoteXY.button_8==0)?LOW:HIGH);
digitalWrite(PIN_BUTTON_9, (RemoteXY.button_9==0)?LOW:HIGH);
// TODO you loop code
// use the RemoteXY structure for data transfer
}
using this formula, "digitalWrite(PIN_BUTTON_9, (RemoteXY.button_9==0)?LOW:HIGH);", is there a syntax for digitalWrite that would allow me to assign more than one pin_button?