- Edited
USB-A to USB-A ... In USB 2.0 you always need one host and one device. You may make it work USB-A to USB-A because you could configure it in software one as a host and one as a device, in defiance of what the connector would suggest ... but then you'd need to find a rare USB-A plug to USB-A plug cable with data lines ...
FelixDoyon Or is it just a basic Serial communication?
If you've set up the IPs, then use the network interface , sending UDP messages back and forth. Use the UdpClient / UdpServer classes.
Something like
// to send
#include <libraries/UdpClient/UdpClient.h>
UdpClient client;
// in setup()
client.setup(port, ip_address);
// from a non-realtime thread:
client.send(buf, size);
// to receive
#include <libraries/UdpServer/UdpServer.h>
UdpServer server;
// in setup()
server.setup(port);
// from a non-realtime thread:
uint8_t buf[maxLen];
int ret = server.waitUntilReady(timeout)
if (-1 == ret) {
// handle error
} else if (1 == ret) {
// receive one packet
int len = server.read(buf, maxLen false);
if(len < 0) {
// handle error
} else {
printf("From %s:%d received %d bytes: ", server.getLastRecvAddr(), server.getLastRecvPort(), len);
for(int n = 0; n < len; ++n)
printf("%d", buf[len]);
printf("\n");
}
}