Hi all,
I am attempting to send data to a server, which happens to be a computer acting as a server, but am having some issues getting the connection.
I have USB-Mini powering my Feather M0 and connected to that board I have an Adafruit Ethernet FeatherWing. This FeatherWing is connected to my laptop via ethernet.
I've been trying to receive on the computer/server using SocketTest. I am using the Server tab and am using the IP address shown for the ethernet adapter in ipconfig /all
. I am trying to listen in on port 21.
I know it's not connecting because the serial monitor repeatedly outputs that is has no connection (via the print statement). I am attempting to send data to the server in the loop
function. The loop function is somewhat irrelevant however, and does not form any connections on its own. If someone would like to see it, please let me know!
My code to try to get these two to communicate looks like this (I have intentionally excluded the loop function):
#include <Ethernet.h>
#include <SPI.h>
#include <Adafruit_ZeroI2S.h>
#include "wiring_private.h"
#define SAMPLERATE_HZ 44100
// Setting up hardware and software info for the Ethernet connection
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(169,254,237,218); // Assigned IP Address for board. This is an arbitrary value.
IPAddress server(169,254,237,217); // IP Address of Ethernet Adapter.
EthernetClient client;
// Setting up sampling information for the microphone
int sample_left = 0;
int sample_right = 0;
int sample = 0;
int32_t left,right;
Adafruit_ZeroI2S i2s(0,1,9,11); // Initializing the I2S interface
void setup()
{
// Begin both the Ethernet connection and I2S interface
Ethernet.begin(mac,ip);
i2s.begin(I2S_32_BIT,SAMPLERATE_HZ);
// Begin Serial interface, and wait until it's fully set up
Serial.begin(9600);
while(!Serial) {
;
}
// Enabling the microcontroller to receive data, and setting Pin 11 as output (for channel select)
i2s.enableRx();
pinMode(11, OUTPUT);
Serial.print("Local IP: ");
Serial.println(Ethernet.localIP());
Serial.println("connecting...");
// Waiting for the client to the server (Client:Feather::Server:Labview)
while(!client.connect(server,21)){ // The second argument is the port.
Serial.println("Waiting for a connection"); // NEVER GETS PAST THIS LINE
}
Serial.println("connected!");
client.println("Hello world!");
To clarify:
- the
ip
variable has an arbitrary ethernet value - the
server
variable has the IP address displayed for the ethernet adapter inipconfig /all
- the MAC Address is right as far as I'm aware... (this code is a hand-me-down, and this is what they had when it was working). I would really appreciate it if someone told me where to find the MAC Address of the board.
My ethernet adapter on the computer looks like this if I run ipconfig /all
:
Any ideas are welcome! I am a novice when it comes to networking, although I've been using Arduino for quite some time!
Thanks!