conexión UDP raspberry

recibo una valor por medio de UDP desde una raspberry, al cambiar el valor en la rasberry en arduino sigue reconociendo el anterior, por lo cual no se ejecuta el proceso en tiempo real, como puedo hacer para que reconosca imendiatamente el cambio de valor o borar la informacion del packet buffer ?

I receive a UDP value by a raspberry, when i change the value in the rasberry in arduino continues to recognize the previous one in which there is the process in real time, how can I erase the packet buffer or that arduino recognizes immediately the change in value?

how can I erase the packet buffer or that arduino recognizes immediately the change in value?

There must be something wrong with your code.

If you really wanted help in fixing the problem, you would have posted your code, in code tags.

his is my code
When there are changes of value in the rasberry it is not updated immediately in arduino the previous value is maintained for a moment

input signal is a constant
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>

int led1 = 6;
int led2 = 7;
//DIRECION MAC DEL ETHERNET
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress ip(169,254,0,55);

unsigned int localPort = 42500;

EthernetUDP Udp;

byte packetBuffer [UDP_TX_PACKET_MAX_SIZE];
byte ReplyBuffer []="acknowledged";

void setup(){
Ethernet.begin(mac,ip);
Udp.begin(localPort);
Serial.begin(9600);
pinMode (6,OUTPUT);
pinMode (7,OUTPUT);
}

void loop(){

int packetSize = Udp.parsePacket();
if (packetSize>0){
Serial.print("Recibido mensaje de tamaño ");
Serial.println(packetSize);
Serial.print("From ");

IPAddress remote = Udp.remoteIP();
for (int i=0; i < 4; i++) {
Serial.print(remote*, DEC);*

  • if (i < 3) {*

  • Serial.print(".");*

  • }*

  • }*

  • Serial.print(", port ");*

  • Serial.println(Udp.remotePort());*

  • Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);*

  • Serial.print("Contenido:");*

  • int a1=packetBuffer[0];*

  • Serial.print(a1);*

  • if (a1==30) {*

  • digitalWrite(led1 , HIGH); *

  • delay(1000); *

  • digitalWrite(led1 , LOW); *

  • delay(1000);}*

  • else {*

  • if (a1==40) {*

  • digitalWrite(led2 , HIGH); *

  • delay(1000); *

  • digitalWrite(led2 , LOW); *

  • delay(1000);*

  • }} }*

  • delay(100);*

  • }*