FHEM Forum

Verschiedenes => Bastelecke => Thema gestartet von: Ralf9 am 08 Juli 2015, 23:02:38

Titel: Arduino Nano mit Ethernet Modul an fhem anbinden
Beitrag von: Ralf9 am 08 Juli 2015, 23:02:38
Hallo,

ich möchte mit dem Arduino Nano und der HM485-Lib ein Homematic Wired kompatibles Modul zusammenbauen.
Die Anbindung an das HM-wired Modul (00_HM485_LAN.pm) von fhem möchte ich über Ethernet realisieren.

Als Ethernet Modul habe ich an das "Mini W5100 LAN Ethernet Shield Network Modul" gedacht.
http://www.ebay.de/itm/New-Mini-W5100-LAN-Ethernet-Shield-Network-Module-board-Fur-Arduino-DE-TE230-/261950470314?pt=LH_DefaultDomain_77&hash=item3cfd76f8aa

Kann ich diese Ethernet library auch für das obrige Modul verwenden?
https://www.arduino.cc/en/reference/ethernet

Bei dieser Ethernet library habe ich unter "Server class" das folgende Beispiel gefunden:

#include <Ethernet.h>
#include <SPI.h>

// the media access control (ethernet hardware) address for the shield:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//the IP address for the shield:
byte ip[] = { 10, 0, 0, 177 };   
// the router's gateway address:
byte gateway[] = { 10, 0, 0, 1 };
// the subnet:
byte subnet[] = { 255, 255, 0, 0 };


// telnet defaults to port 23
EthernetServer server = EthernetServer(23);

void setup()
{
  // initialize the ethernet device
  Ethernet.begin(mac, ip, gateway, subnet);

  // start listening for clients
  server.begin();
}

void loop()
{
  // if an incoming client connects, there will be bytes available to read:
  EthernetClient client = server.available();
  if (client) {
    // read bytes from the incoming client and write them back
    // to any clients connected to the server:
    server.write(client.read());
  }
}


Hier wird ganz unten "client.read()" verwendet obwohl es unter der "Server class" kein read gibt.
Dies verstehe ich nicht.

Danke und Gruß Ralf