Arduino wireless serial

Hello, I am currently working on a project in which I use an arduino and a relay to open and close a gate. I already have the relay portion working pretty well using serial commands, but I want to control this through a web app. I know I can do this with a rasp. pi, but I really don't want to mess with re-programming everything. I already have NRF24LO1 modules that have antennae, but I am not sure what the range is, how to code it, and how to hook it up to a computer. It needs to have a range of about 500 yards, and I am not sure if the NRF would reach that far. My current code is this:

void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);

}


void loop() {

  if (Serial.available()) {
    
    char ser = Serial.read();    //read serial as a character
    
    switch (ser) {  
     
      case 'C':
        digitalWrite(13, HIGH);
      break;

      case 'O':
        digitalWrite(13, LOW);
      break;

    }
    
    
  }
}

I would also like to have it only work if one of two buttons is pressed.

A lower-frequency wireless might be better for that range - for example HC-12 modules work at 433MHz.

LoRa modules would easily reach 500 yards.

You will need some means to interface the Wep app with any of those wireless systems. Have you the option of setting up a high-gain directional WiFi antenna. If so maybe you could use an ESP8266 at the remote location - but you would need to experiment. I have had a couple of ESP8266 modules communicating at a range of about 100 metres with the standard PCB antennas.

...R

Thank you. I will have to look into that. I already got the button part of it working. was a simple issue with logic. slaps face

I added a few words at the end of Reply #1 as it occurred to me it may not have been obvious that I was just using the standard antennas in my distance test.

...R

when you say 'hook it up to a computer', if you have the nrf24's then use it with an arduino, and read/write data via the arduino usb port. Or did you mean something more exotic? Robin2 has a basic Rx/Tx tutorial that would be simple to modify to send a few button presses/whatever. You'd need two arduino's and two of the nrf modules, and you could easily test the range. 500 metres may be OK.