how to set up RGB leds with an udp instruction

hello! everyone! im working on a kind of trafic light with rgb leds, i try to take an udp value sended from a server to the arduino mega and ethernet shield, then the arduino should change the color of the led.

saddly until now, it does not work, in the serial monitor i find out that the udp packet was recived, but then the led does not work U.U i was hoping that you guys can helpme to figure out why my code isnt working, thank u in advance!!

the code is this

  Web Server

 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.

 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 modified 02 Sept 2015
 by Arturo Guadalupi

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>


    void Color(int R, int G, int B)
          analogWrite(3, R) ;   // Rojo
          analogWrite(5, G) ;   // Green - Verde
          analogWrite(6, B) ;   // Blue - Azul

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 90, 111, 150);

unsigned int localPort = 8888;      // local port to listen on

// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];  // buffer to hold incoming packet,
char ReplyBuffer[] = "acknowledged";        // a string to send back

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
       pinMode(3, OUTPUT);
       pinMode(5, OUTPUT);
       pinMode(6, OUTPUT);


  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

    // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  Serial.println("Ethernet WebServer Example");

  // Check for Ethernet hardware present
  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
    while (true) {
      delay(1); // do nothing, no point running without Ethernet hardware
  if (Ethernet.linkStatus() == LinkOFF) {
    Serial.println("Ethernet cable is not connected.");

  // start the server
  Serial.print("server is at ");

void loop() {

// if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if (packetSize) {
    Serial.print("Received packet of size ");
    Serial.print("From ");
    IPAddress remote = Udp.remoteIP();
    for (int i=0; i < 4; i++) {
      Serial.print(remote[i], DEC);
      if (i < 3) {
    Serial.print(", port ");

    // read the packet into packetBufffer, UDP_TX_PACKET_MAX_SIZE);
    // send a reply to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());

       char numero = packetBuffer;
         if (numero = "1") Color(250, 0, 0) ;
         if (numero = "2") Color(100, 110, 0);
         if (numero = "3") Color(0, 255, 0); 

 char numero = packetBuffer;

packetBuffer is an array, you need an index to specify which byte of the array you want to read something like:

 char numero = packetBuffer[i];

Where i is the correct index for the byte you want.

I don't know if the rest of your code is OK or not.

++Karma for posting code correctly on your first post.