RS485_UDP_Send_01

 

   Library:
   www.info.kmtronic.com/software/DINo/UDP_Examp...erShield_1.7.UDP.zip

 

 ==================================================================================

 

 

 

            #include "EtherShield.h"

            uint8_t mymac[6] = {0x00,0xE0,0x4C,0x55,0x83,0x78};
            uint8_t myip[4] = {192,168,10,25};
            uint16_t MYWWWPORT = 80;
            
            
            uint8_t udpmac[6] = {0x00,0x1D,0x0F,0xD4,0xB2,0xD9};
            uint8_t udpip[4] = {88,87,29,148};

            #define BUFFER_SIZE 750
            static uint8_t buf[BUFFER_SIZE+1];

            char response[]="00000000";

            EtherShield es=EtherShield();

            uint16_t dat_p;
            

            ///----------------------------------------------------------
            void setup(){
              
            Serial.begin(9600);

            es.ES_enc28j60Init(mymac);
            es.ES_init_ip_arp_udp_tcp(mymac,myip, MYWWWPORT);

            } // end setup


            ///----------------------------------------------------------
            void loop(){
            
              dat_p=es.ES_packetloop_icmp_tcp(buf,es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf));

              if (Serial.available())  {

              response[0] = Serial.read();

              es.ES_send_udp(buf,response,8,12345, udpip, 12345, udpmac);

              }
            } // end loop

 

 

 

 

Read 2382 times