firmata / arduino

Firmata firmware for Arduino
GNU Lesser General Public License v2.1
1.53k stars 515 forks source link

Ethernet server mode versus client mode #501

Open ale-novo opened 1 year ago

ale-novo commented 1 year ago

Im using Perl-firmata as Server, and Firmata sketch as client with ethernet to connect several boards.

I have to hardcode in each board these values:

byte mac[] = {
  0xDE, 0x55, 0x5E, 0xE5, 0xFE, 0x53 };
int remotePort = 3053;
IPAddress localIp(10, 0, 0, 253);
IPAddress remoteIp(10, 0, 0, 105);

if the server ip or port changes, i need to re flash.

i can try using a hostname but need to test to understand it that works.

Ive seen firmata also supports running as 'server', to me that is interesting.

What would be the advantages of running like so, firmata in server mode and perl-firmata in client? apart from not having to hard code the ip and port?

what would be the system requirements memory and cpu for slower boards like nano?

i would need to refactor perl firmata and that is not trivial so its a significant chunk of work so i want to make sure its worth.

thanks.

pgrawehr commented 11 months ago

Actually, I'm always running firmata in server mode (when I'm using network), because it's usually simpler to have a more complex connection logic on the PC side than in firmware. I have only tested Wifi mode with ESP32 though, so I don't know whether it needs more resources than client mode - I expect not really. Of course, you still need to reflash when you want to change the IP. I typically use DHCP though and tell the router to always assign the same IP to my board, so I can always reach it under the same IP.

For ESP32, there's even support for DNS lookups.