Can you please give me an example of how to connect my computer to Arduino using EtherCard library? I want to send a string of text using Python's socket module and send this text back to the serial port. I tried to follow official exaples, but the python's side says it cannot connect. Here is what I tried:

#include <EtherCard.h>

static byte myip[] = { 192,168,1,3 };
static byte gwip[] = { 192,168,1,1 };
static byte mymac[] = { 0x70,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[200];

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

void setup() {
  // put your setup code here, to run once:
   if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println("Failed to access Ethernet controller");
  ether.staticSetup(myip, gwip);
  ether.printIp("IP:  ", ether.myip);
 // ether.udpServerListenOnPort(&udpSerialPrint, 23);


void loop() {
  // put your main code here, to run repeatedly:
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
    // check if valid tcp data is received
    if (pos) {
        char* data = (char *) Ethernet::buffer;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.