Jack Hansdampf / Mbed OS WebSwitch_ENC28J60_GSOE

Dependencies:   UIPEthernet_GSOE

Revision:
18:02264a85fdda
Parent:
15:9beb9b99695d
diff -r a344f80b4f19 -r 02264a85fdda main.cpp
--- a/main.cpp	Thu Jul 23 15:32:33 2020 +0000
+++ b/main.cpp	Fri Aug 20 12:36:49 2021 +0000
@@ -1,3 +1,4 @@
+//nach Zoltan Houdek
 #include "mbed.h"
 #include <string>
 #include "UipEthernet.h"
@@ -11,14 +12,14 @@
 #define NETMASK "255.255.255.0"
 #define PORT    80
 const uint8_t   MAC[6] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x06 };
-UipEthernet     net(MAC, D11, D12, D13, D10);   // mosi, miso, sck, cs
+UipEthernet     net(MAC, PB_15, PB_14, PB_13, PB_12);   // mosi, miso, sck, cs
 TcpServer       server;                         // Ethernet server
 TcpClient*      client;
 char            httpBuf[1500];
 char            httpHeader[256];
 const int       OFF = 0;
 const int       ON = 1;
-DigitalOut      output(D3);                     // A digital output to be switched on/off
+DigitalOut      output(PA_5);                     // A digital output to be switched on/off
 float           roomTemp = 21.8f;               // A temperature sensor output
 const char      PASSWORD[] = "secret";          // Change as you like
 
@@ -39,6 +40,9 @@
  */
 int8_t analyseURL(char* url)
 {
+        return 1;
+        uint8_t pos = 5;
+    /*
     if (strlen(url) < (5 + strlen(PASSWORD) + 1))
         return(-1);
 
@@ -56,7 +60,7 @@
     //if (url.substr(pos++, 1) == " ")
     if (*(url + pos++) == ' ')
         return(-2);
-
+*/
     //string  cmd(url.substr(pos, 5));
     *(url + pos + 5) = '\0';    // terminate the cmd string
     char*   cmd = ((url + pos));
@@ -231,14 +235,14 @@
 {
     printf("Starting ...\r\n");
 
-    //net.set_network(IP, NETMASK, GATEWAY);  // include this for using static IP address
-    if (net.connect(30) != 0) {
+    net.set_network(IP, NETMASK, GATEWAY);  // include this for using static IP address
+    if (net.connect(60) != 0) {
 
         // 'connect' timeout in seconds (defaults to 60 sec)
         printf("Unable to connet.\r\n");
         return -1;
     }
-
+    printf("connected");
     // Show the network address
     SocketAddress   addr;
     net.get_ip_address(&addr);