ESP32 NOW programming

I am using 2 ESP32 DEV boards to communicate with each other as Master and Slave and have used the example sketches MASTER and SLAVE from the Arduino IDE (Examples>ESP32>ESPNOW>Multislave)
to enable communication between them
The communication works well and following some modification I am able to define GPIO 16 as an output on the master and GPIO 16 as an INPUT on the slave and on taking the pin high on the master operate an LED attached to GPIO 16 on the slave. as per the snippet of code below.

MASTER
#define CHANNEL 3
#define IR_PIN 16
#define NUM_SLAVES 20 // ESP-Now can handle a maximum of 20 slaves
#define PRINTSCANRESULTS 0

int slaveCount = 0; // Keeps count of no. of slaves with the defined prefix
esp_now_peer_info_t slaves[NUM_SLAVES]; // Stores the information of each of the slave that is added as a peer

void initESPNow();
void manageSlaves();
void scanForSlaves();
void onDataSent(const uint8_t *mac_addr, esp_now_send_status_t status);
void onDataRecv(const uint8_t *mac_add, const uint8_t *data, int data_len);
void sendData(uint8_t data);

void setup()
{
Serial.begin(115200);

pinMode(IR_PIN, INPUT);

//Set device in STA mode to begin with
WiFi.mode(WIFI_MODE_STA);

// This is the mac address of the Master in Station Mode
Serial.print("STA MAC: ");
Serial.println(WiFi.macAddress());

// Init ESPNow with a fallback logic
initESPNow();

// Once ESPNow is successfully Init, we will register for Send CB to
// get the status of Trasnmitted packet
esp_now_register_send_cb(onDataSent);
esp_now_register_recv_cb(onDataRecv);

scanForSlaves();
manageSlaves();
}

void loop()
{
Serial.println("Digital Read: " + String(digitalRead(IR_PIN)));

if(slaveCount > 0)
{
if(digitalRead(IR_PIN))
{
// Send 1 to turn on the LED
sendData(1);
}
else
{
// Send 0 to turn off the LED
sendData(0);
}
}
delay(100);
}

SLAVE

#define GPIO 16
#define CHANNEL 1
#define SENDCHANNEL 1
#define WIFI_DEFAULT_CHANNEL 3

uint8_t gpioStatus = 0;
esp_now_peer_info_t peer;

void initESPNow();
void configDeviceAP();
void addPeer(uint8_t *peerMacAddress);
void onDataSent(const uint8_t *mac_addr, esp_now_send_status_t status);
void onDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len);

void setup()
{
Serial.begin(115200);

//Set device in AP mode to begin with
WiFi.mode(WIFI_AP);

// configure device AP mode
configDeviceAP();

// This is the mac address of the Slave in AP Mode
Serial.print("AP MAC: ");
Serial.println(WiFi.softAPmacAddress());

// Init ESPNow with a fallback logic
initESPNow();

// Once ESPNow is successfully Init, we will register for recv CB to
// get recv packer info.
esp_now_register_send_cb(onDataSent);
esp_now_register_recv_cb(onDataRecv);

pinMode(GPIO, OUTPUT);
}

void loop()
{
digitalWrite(GPIO, gpioStatus);
delay(10);
}

I now want to Define a second GPIO Pin (say 17) on the Master and Slave with the objective of allowing
each of the pins on the master to activate its counterpart on the slave independently.
It is easy to define an additional pin on the master and send data when its is switched from LOW to HIGH but I cannot figure out how to deal with the receipt of the data by the slave to route it to the correct GPIO pin. When I try any pin activation (16 or 17) on the master results in both pins on the slave being activated.
Are there any ESPNow tutorials dealing with this issue or does anyone have any ideas to help me?
Thanks

Please read the posts at the top of this Forum for the proper way to post code using code tags.

I am trying to move a stepper with a web server and a touch sensor but it gives me this error
expected unqualified-id before 'if'
any help would be appreciated. this code is not quite done I am new to coding so I am pulling code from other examples.

#include <WiFi.h>

const char* ssid = "yourssid";
const char* password = "yourpasswd";

WiFiServer server(80);

#include <Stepper.h>

const int slide = 400;

const int touchPin = 4;

const int threshold = 20;
int val=0;

int touchValue;

Stepper myStepper(400, 8, 9, 10, 11);
void setup()
{
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

server.begin();

myStepper.setSpeed(60);
Serial.begin(115200);
delay(1000); // give me time to bring up serial monitor
Serial.println("powering up");
}
int value = 0;

void loop()
{

WiFiClient client = server.available(); // listen for incoming clients

if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
if (c == '\n') { // if the byte is a newline character

// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();

// the content of the HTTP response follows the header:
client.print("Click <a href="/H">here to turn the LED on pin 5 on.
");
client.print("Click <a href="/L">here to turn the LED on pin 5 off.
");

// The HTTP response ends with another blank line:
client.println();
// break out of the while loop:
break;
} else { // if you got a newline, then clear currentLine:
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}

// Check to see if the client request was "GET /H" or "GET /L":
if (currentLine.endsWith("GET /H")) {
digitalWrite(5, HIGH); // GET /H turns the LED on
}
if (currentLine.endsWith("GET /L")) {
digitalWrite(5, LOW); // GET /L turns the LED off
}
}
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
if(touchValue < threshold){
val==2;
}
else{
val==0;
}
}
if(val==2){
myStepper.step(slide);
Serial.println("opening");
}
}
if(slide==slide){

myStepper.step(-slide);
Serial.println("CLOSING");
}
}

See reply #1.