• quel qu'un pour

    From zeneca@3:770/3 to All on Sun Jun 19 15:25:52 2022
    répondre a des questions sur ESP8266 & Arduino ??
    Merci

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From JJenssen@3:770/3 to All on Mon Jun 20 11:41:21 2022
    Am 19.06.22 um 15:25 schrieb zeneca:
    répondre a des questions sur ESP8266 & Arduino ??
    Merci


    Don't believe one will do in French :(
    ___
    Regards
    JJenssen

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From zeneca@3:770/3 to All on Mon Jun 20 12:28:25 2022
    Le 20/06/22 à 11:41, JJenssen a écrit :
    Am 19.06.22 um 15:25 schrieb zeneca:
    répondre a des questions sur ESP8266 & Arduino ??
    Merci


    Don't believe one will do in French :(
    ___
    Regards
    JJenssen
    OK, let's try
    I would like to find a way allowing several siteId in a configuration.
    The system (a NodeMcu8266) would try them in sequence.
    For that I am trying:

    struct netw
    {
    char *MXWifi;/*ssid*/
    char *YYYZY; /*passwd*/
    const char *MyIp; /*ip adress*/
    struct netw *next;
    };

    struct netw prem = {"AAACCCCCC","xvdfgghs","192,168,1,32"};
    struct netw seco = {"Orange-aaa","7XyZzR","192,168,0,32"};

    struct netw *current;

    In setup()

    IPAddress local_IP(MYIpad);
    IPAddress gateway(MYGatew);

    DoConnect();


    in
    void Doconnect() {

    while(1) {
    Serial.println(current->MXWifi);
    Serial.println(current->YYYZY);
    Serial.println(current->MyIp);

    // IPAddress local_IP(current->MyIp);
    Serial.println("-------------------");

    if (current->next != &prem) {
    current = current->next;
    } else {
    current = &prem;
    break;
    }


    }

    Compilation fail on current->MyIP
    Doesn't' accept 198,162... nor 198.162...
    Type IPAdress seem to only accept:

    #define MYIpad 192,168,0,32

    Typically Arduino??

    Many thanks in advances
    André

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jean-Pierre Kuypers@3:770/3 to joemajen@arcor.de on Mon Jun 20 12:37:40 2022
    In article (Dans l'article) <t8pfbu$rp3$1@dont-email.me>, JJenssen <joemajen@arcor.de> wrote (écrivait) :

    Am 19.06.22 um 15:25 schrieb zeneca:
    répondre a des questions sur ESP8266 & Arduino ??
    Merci

    Don't believe one will do in French :(

    French speaking people can use <news:fr.comp.sys.raspberry-pi>

    --
    Jean-Pierre Kuypers

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to A. Dumas on Mon Jun 20 13:11:48 2022
    A. Dumas <alexandre@dumas.fr.invalid> wrote:
    On 20-06-2022 12:28, zeneca wrote:
    struct netw
    {
         char *MXWifi;/*ssid*/
         char *YYYZY; /*passwd*/
         const char *MyIp; /*ip adress*/
         struct netw *next;
    };

    struct netw prem = {"AAACCCCCC","xvdfgghs","192,168,1,32"};
    struct netw seco = {"Orange-aaa","7XyZzR","192,168,0,32"};
    [...]
    Compilation fail on current->MyIP
    Doesn't' accept 198,162... nor 198.162...
    Type IPAdress seem to only accept:

    #define MYIpad 192,168,0,32

    I have never seen anything using commas in IP addresses instead of
    periods. It is not an arithmatic number, so those are not decimal
    points, so I can't imagine anyone, ever, anywhere needing to translate periods to commas or vice versa in IP addresses. If your library does do that, I'd be looking for a different library.

    It is actually how they do it: https://www.arduino.cc/reference/en/libraries/ethernet/ipaddress/
    however it's a constructor which accepts four arguments, being the four 8
    bit chunks of the IPv4 address: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.h#L70 https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.cpp#L38

    Hence you can do:
    IPAddress alice(127,0,0,1);

    which creates an instance of the IPAddress class pre-initialised with
    the four octets from 127.0.0.1

    But, looking at that code, I think you need fromString() to parse the string
    in a "127.0.0.1" format, ie:

    IPAddress local_ip();
    local_ip.fromString(prem.MyIp); // sets local_ip to address in MyIp

    - which is more time consuming and error prone than the constructor which
    just accepts (127,0,0,1) as arguments.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to zeneca on Mon Jun 20 13:31:48 2022
    On 20-06-2022 12:28, zeneca wrote:
    struct netw
    {
         char *MXWifi;/*ssid*/
         char *YYYZY; /*passwd*/
         const char *MyIp; /*ip adress*/
         struct netw *next;
    };

    struct netw prem = {"AAACCCCCC","xvdfgghs","192,168,1,32"};
    struct netw seco = {"Orange-aaa","7XyZzR","192,168,0,32"};
    [...]
    Compilation fail on current->MyIP
    Doesn't' accept 198,162... nor 198.162...
    Type IPAdress seem to only accept:

    #define MYIpad 192,168,0,32

    I have never seen anything using commas in IP addresses instead of
    periods. It is not an arithmatic number, so those are not decimal
    points, so I can't imagine anyone, ever, anywhere needing to translate
    periods to commas or vice versa in IP addresses. If your library does do
    that, I'd be looking for a different library.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Theo on Mon Jun 20 14:56:36 2022
    On 20-06-2022 14:11, Theo wrote:
    It is actually how they do it: https://www.arduino.cc/reference/en/libraries/ethernet/ipaddress/
    however it's a constructor which accepts four arguments, being the four 8
    bit chunks of the IPv4 address: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.h#L70 https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.cpp#L38

    Hence you can do:
    IPAddress alice(127,0,0,1);

    Oh, ha. Yeah that can be useful and I guess OP misunderstood that it
    wasn't one string.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From zeneca@3:770/3 to All on Mon Jun 20 14:31:19 2022
    Le 19/06/22 à 15:25, zeneca a écrit :

    I misspelled my question:

    I would like to find a way allowing several siteId in a configuration.
    The system (a NodeMcu8266) would try them in sequence.
    For that I am trying:

    struct netw
    {
    char *MXWifi;/*ssid*/
    char *YYYZY; /*passwd*/
    const char *MyIp; /*ip adress*/
    struct netw *next;
    };

    struct netw prem = {"AAACCCCCC","xvdfgghs","192,168,1,32"};
    struct netw seco = {"Orange-aaa","7XyZzR","192,168,0,32"};

    struct netw *current;

    In setup()

    DoConnect();


    in
    void Doconnect() {

    while(1) {

    const char* ssid = current->MXWifi;
    const char* password = current->YYYZY;

    IPAddress local_IP(current->MyIp);

    Serial.println(current->MXWifi);
    Serial.println(current->YYYZY);
    Serial.println(current->MyIp);
    Serial.println("-------------------");

    if (current->next != &prem) {
    current = current->next;
    } else {
    current = &prem;
    break;
    }


    }

    Compilation fail on current->MyIP
    Doesn't' accept 198,162... nor 198.162...
    Type IPAdress seem to only accept:

    #define MYIpad 192,168,0,32

    Typically Arduino??

    Many thanks in advances
    André

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Nikolaj Lazic@3:770/3 to All on Tue Jun 21 11:52:58 2022
    Dana Sun, 19 Jun 2022 15:25:52 +0200, zeneca <pasIci@ailleur.fr> napis'o:
    répondre a des questions sur ESP8266 & Arduino ??
    Merci

    As this is for PI which uses Linux, you should look at: https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-examples.html
    And look at WiFiMulti.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From zeneca@3:770/3 to All on Tue Jun 21 14:40:22 2022
    Le 21/06/22 à 13:52, Nikolaj Lazic a écrit :
    Dana Sun, 19 Jun 2022 15:25:52 +0200, zeneca <pasIci@ailleur.fr> napis'o:
    répondre a des questions sur ESP8266 & Arduino ??_IP(
    Merci

    As this is for PI which uses Linux, you should look at: https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-examples.html
    And look at WiFiMulti.
    Interesting, I will have a try.
    But the problem I a facing is my local provider doesnt give fixed ip
    address. So I have to give IPAdresse local_IP(MyIpAd);
    MyIpAd is
    #define 192,168,0,111 in another file.
    Regards

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From zeneca@3:770/3 to All on Tue Jun 21 16:08:40 2022
    Le 21/06/22 à 15:45, Martin Gregorie a écrit :
    On Tue, 21 Jun 2022 14:40:22 +0200, zeneca wrote:

    Le 21/06/22 à 13:52, Nikolaj Lazic a écrit :
    Dana Sun, 19 Jun 2022 15:25:52 +0200, zeneca <pasIci@ailleur.fr>
    napis'o:
    répondre a des questions sur ESP8266 & Arduino ??_IP(
    Merci

    As this is for PI which uses Linux, you should look at:
    https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-
    examples.html
    And look at WiFiMulti.
    Interesting, I will have a try.
    But the problem I a facing is my local provider doesnt give fixed ip
    address. So I have to give IPAdresse local_IP(MyIpAd);
    MyIpAd is #define 192,168,0,111 in another file.I think
    Regards

    Run a local DNS (named, kea or knot) - I'm running named.
    Set it up to be authoritative for your local LAN and to pass all other requests to the global root DNS servers.


    I think I will start a HOTSPOT on a Raspberry (maybe a Zero ) with
    dnsmask (dns and DHCP ) it also une local host table, and so be rid of
    the problem. But I need to use an extra system for this wich is...
    The Raspberry should have a second ethernet access (cable or a second
    wlan? looking for a Raspberry zero 2wh )

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to zeneca on Tue Jun 21 13:45:54 2022
    On Tue, 21 Jun 2022 14:40:22 +0200, zeneca wrote:

    Le 21/06/22 à 13:52, Nikolaj Lazic a écrit :
    Dana Sun, 19 Jun 2022 15:25:52 +0200, zeneca <pasIci@ailleur.fr>
    napis'o:
    répondre a des questions sur ESP8266 & Arduino ??_IP(
    Merci

    As this is for PI which uses Linux, you should look at:
    https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station- examples.html
    And look at WiFiMulti.
    Interesting, I will have a try.
    But the problem I a facing is my local provider doesnt give fixed ip
    address. So I have to give IPAdresse local_IP(MyIpAd);
    MyIpAd is #define 192,168,0,111 in another file.
    Regards

    Run a local DNS (named, kea or knot) - I'm running named.
    Set it up to be authoritative for your local LAN and to pass all other
    requests to the global root DNS servers.


    --

    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From DeepCore@3:770/3 to All on Tue Jun 21 17:13:51 2022
    Am 20.06.2022 um 14:31 schrieb zeneca:

    struct netw
    {
         char *MXWifi;/*ssid*/
         char *YYYZY; /*passwd*/
         const char *MyIp; /*ip adress*/
         struct netw *next;
    };

    There is the problem -> const char *MyIp; /*ip adress*/

    In Arduino IPAddress class is defined (in IPAddress.h) as:

    IPAddress();
    IPAddress(uint8_t first_octet,
    uint8_t second_octet,
    uint8_t third_octet,
    uint8_t fourth_octet);
    IPAddress(uint32_t address);
    IPAddress(const uint8_t *address);


    So the line

    #define MYIpad 192,168,0,32

    defines only a place holder 'MYIpad' and this satisfies the second
    definition above: IPAddress(MYIpad) -> IPAddress(192, 168, 0, 32)

    You have to give the class initialiser 4 octets

    Or you make a unsigned integer of 32 bits from the 4 octets, to store in
    your struct...

    Hope this helps
    Philippe

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ahem A Rivet's Shot@3:770/3 to zeneca on Tue Jun 21 17:41:50 2022
    On Tue, 21 Jun 2022 16:08:40 +0200
    zeneca <pasIci@ailleur.fr> wrote:

    I think I will start a HOTSPOT on a Raspberry (maybe a Zero ) with
    dnsmask (dns and DHCP ) it also une local host table, and so be rid of
    the problem. But I need to use an extra system for this wich is...
    The Raspberry should have a second ethernet access

    How much bandwidth do you need ? Do you have a managed switch ? If
    the answers are favourable then you could run two VLANs out of the Pi and
    use the managed switch to present them to separate ports without the
    tagging. I did this years ago using an original Pi as a router.

    --
    Steve O'Hara-Smith
    Odds and Ends at http://www.sohara.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Thierry P@3:770/3 to All on Wed Jun 22 12:06:05 2022
    Le 19/06/2022 zeneca <pasIci@ailleur.fr> écrivait :

    répondre a des questions sur ESP8266 & Arduino ??
    Merci

    raspberry != Arduino

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Nikolaj Lazic@3:770/3 to All on Thu Jun 23 14:06:57 2022
    Dana Tue, 21 Jun 2022 14:40:22 +0200, zeneca <pasIci@ailleur.fr> napis'o:
    Le 21/06/22 à 13:52, Nikolaj Lazic a écrit :
    Dana Sun, 19 Jun 2022 15:25:52 +0200, zeneca <pasIci@ailleur.fr> napis'o: >>> répondre a des questions sur ESP8266 & Arduino ??_IP(
    Merci

    As this is for PI which uses Linux, you should look at:
    https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-examples.html
    And look at WiFiMulti.
    Interesting, I will have a try.
    But the problem I a facing is my local provider doesnt give fixed ip

    Your home AP handles DHCP requests. Your ESP will get local IP.
    Than your AP will send all your outgoing requests from its own address.
    In case you need to access your ESP from the net you will have to
    do port forwarding from your AP. That way you will be able to access your
    ESP from the net.

    If you need to know your AP's dynamic IP address you can use some kind
    of external service... I have something like this for sending my IP: https://mudrac.ffzg.hr/~nlazic/ip.php?whatever_text&1
    and for getting my IP I use: https://mudrac.ffzg.hr/~nlazic/ip.php?whatever_text

    You just have to send the first line from your ESP.
    Use the second line to get IP from yout AP to contact your ESP through
    port forwarding service on your AP.

    address. So I have to give IPAdresse local_IP(MyIpAd);
    MyIpAd is
    #define 192,168,0,111 in another file.

    You will be given local IP from your home Access point.
    Then sort out how to manage port forwarding on your AP.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Nikolaj Lazic@3:770/3 to All on Thu Jun 23 14:09:54 2022
    Dana Tue, 21 Jun 2022 16:08:40 +0200, zeneca <pasIci@ailleur.fr> napis'o:
    Le 21/06/22 à 15:45, Martin Gregorie a écrit :
    On Tue, 21 Jun 2022 14:40:22 +0200, zeneca wrote:

    Le 21/06/22 à 13:52, Nikolaj Lazic a écrit :
    Dana Sun, 19 Jun 2022 15:25:52 +0200, zeneca <pasIci@ailleur.fr>
    napis'o:
    répondre a des questions sur ESP8266 & Arduino ??_IP(
    Merci

    As this is for PI which uses Linux, you should look at:
    https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-
    examples.html
    And look at WiFiMulti.
    Interesting, I will have a try.
    But the problem I a facing is my local provider doesnt give fixed ip
    address. So I have to give IPAdresse local_IP(MyIpAd);
    MyIpAd is #define 192,168,0,111 in another file.I think
    Regards

    Run a local DNS (named, kea or knot) - I'm running named.
    Set it up to be authoritative for your local LAN and to pass all other
    requests to the global root DNS servers.


    I think I will start a HOTSPOT on a Raspberry (maybe a Zero ) with

    That way you will again get the same functionality as with your AP
    connected to the internet (probably some kind of NAT... or CGNAT).

    dnsmask (dns and DHCP ) it also une local host table, and so be rid of
    the problem. But I need to use an extra system for this wich is...
    The Raspberry should have a second ethernet access (cable or a second
    wlan? looking for a Raspberry zero 2wh )

    Zero has USB connection through four testpoints on the board. You can use
    those to connect to some USB HUB and connect anything you need.
    But you have to provide enough power to the USB HUB.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to Martin Gregorie on Tue Jun 21 21:48:49 2022
    Martin Gregorie <martin@mydomain.invalid> wrote:
    On Tue, 21 Jun 2022 14:40:22 +0200, zeneca wrote:

    Le 21/06/22 à 13:52, Nikolaj Lazic a écrit :
    As this is for PI which uses Linux, you should look at:
    https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station- examples.html
    And look at WiFiMulti.
    Interesting, I will have a try.
    But the problem I a facing is my local provider doesnt give fixed ip address. So I have to give IPAdresse local_IP(MyIpAd);
    MyIpAd is #define 192,168,0,111 in another file.
    Regards

    Run a local DNS (named, kea or knot) - I'm running named.
    Set it up to be authoritative for your local LAN and to pass all other requests to the global root DNS servers.

    The OP has an ESP8266 running the Arduino platform. That isn't a Raspberry
    Pi, isn't running Linux, they don't need to run extra servers on a Raspberry
    Pi to simply set an IPv4 address in their ESP8266, which is something that every machine in the last two decades needs to do.

    OP, if you use wifiMulti, it already does DHCP for you. From that link
    above, see the log:

    connected with sensor-net-1, channel 1
    dhcp client start...
    ip:192.168.1.10,mask:255.255.255.0,gw:192.168.1.9

    According to the source: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino
    the IP is printed via:

    Serial.println(WiFi.localIP());

    So presumably that gives you the local IP, should you need it for further
    use.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)