bxUDP_Sender icon

bxUDP_Sender -----

UDP packet sender



Usage:
Code (Text):
/sendudp <ip> <port> <data>
For example:
Code (Text):
/sendudp 192.168.1.105 2137 1
Code (Text):
/sendudp 192.168.1.105 2137 2
Sample code for Arduino with ENC28J60 module
Code (Text):

#include <EtherCard.h>

static byte myip[] = { 192,168,1,105 };
static byte gwip[] = { 192,168,1,1 };
static byte mymac[] = { 0x70,0x69,0x21,0x37,0x42,0x00 }; //adres MAC

byte Ethernet::buffer[500];

void udpSerialPrint(uint16_t dest_port, uint8_t src_ip[IP_LEN], uint16_t src_port, const char *data, uint16_t len){

  if(data[0] == 0x01){
    digitalWrite(5, HIGH);
  }
  else if(data[0] == 0x02){
    digitalWrite(5, LOW);
  }

}
void setup(){
  pinMode(5, OUTPUT);
  Serial.begin(57600);
  ether.begin(sizeof Ethernet::buffer, mymac, 10);
  ether.staticSetup(myip, gwip);
  ether.udpServerListenOnPort(&udpSerialPrint, 2137);
}

void loop(){
  ether.packetLoop(ether.packetReceive());
}
 
Resource Information
Author:
----------
Total Downloads: 31
First Release: May 23, 2022
Last Update: May 23, 2022
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings