IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Arduino Discussion :

Enregistrer donnée sur Mysql Server


Sujet :

Arduino

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut Enregistrer donnée sur Mysql Server
    Bonjour,

    J'ai un soucis avec mon code.

    J'ai branché par ethernet mon arduiono uno avec un ethernet shield officiel sur le port ethernet de mon ordinateur.
    Je n'ai rien configurer d'autres.

    Je cherche à envoyer par GET mes données de téléinfo sur la base de donnée Mysql de mon serveur personnel.
    La page "send_data.php" recevant les données et les insérant dans la base de donnée.

    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    #include <SPI.h>
    #include <Ethernet.h>
    #include <SoftwareSerial.h>
    
    byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0xF9, 0x81 };
    IPAddress ip(192, 168, 0, 16);
    
    char server[] = "www.martin_valentin.fr";
    EthernetClient client;
    
    SoftwareSerial cptSerial(2, 3);
    #define startFrame 0x02
    #define endFrame 0x03
    #define startLine 0x0A
    #define endLine 0x0D
    
    void setup()
    {
      cptSerial.begin(1200);
      Serial.begin(9600);
      Ethernet.begin(mac, ip);
    }
    
    String GetTeleInfo()
    {
        String TeleInfo = "";
        char charIn = 0;
        while (charIn != startLine)
        {
            charIn = cptSerial.read() & 0x7F;
        }
        while (charIn != endLine)
        {
            if (cptSerial.available() > 0)
            {
                charIn = cptSerial.read() & 0x7F;
                TeleInfo += charIn;
            }
        }
        return TeleInfo;
    }
    
    String ShowTeleInfo(String keyword, String unit, int length)
    {
        int essai = 0;
        // Nombre d'étiquettes maximum, cf documentation ERDF
        int max_essais = 33;
        String data = "";
        String msg = "";
        while(data.substring(0,keyword.length()) != keyword && essai != max_essais)
        {
            data = GetTeleInfo();
            essai++;
        }
        msg = "\t<";
        msg += keyword;
        msg += " unit=\"";
        msg += unit;
        msg += "\">";
        if (essai != max_essais)
        {
            msg += data.substring((keyword.length() + 1),(length + (keyword.length() + 1)));
        }
        else
        {
            msg += "NA";
        }
        msg += "</";
        msg += keyword;
        msg += ">";
        return msg;
    }
    
    void loop()
    {
      boolean current_line_is_blank = true;
      if(client.connect(server, 80)) {
        Serial.println("-> Connected");
        char c = client.read();
        if (c == '\n' && current_line_is_blank)
        {
          client.print("GET /teleinfo/send_data.php?");
          client.print("ADCO=");
          client.print(ShowTeleInfo("ADCO","",12));
          client.print("&&");
          client.print("OPTARIF=");
          client.print(ShowTeleInfo("OPTARIF","",4));
          client.print("&&");
          client.print("ISOUSC=");
          client.print(ShowTeleInfo("ISOUSC","A",2));
          ...
          client.println(" HTTP/1.1");
          client.println("Host: www.martin_valentin.fr");
          client.println("Connection: close");
          client.println();
          client.println();
          client.stop();
          }
        if (c == '\n')
        {
            current_line_is_blank = true;
        }
        else if (c != '\r')
        {
            current_line_is_blank = false;
        }
      } else {
        Serial.println("--> connection failed\n");
      }
      delay(200);
      client.stop();
    }

    Mon soucis est que dans loop(), l'envoie ne se fait pas et m'affiche directement "--> connection failed".
    Je pense donc avoir mal configuré mon ethernet ou il manque une info mais je ne vois pas où est le soucis.

    Je vous remercie d'avance pour votre aide

    Valentin

  2. #2
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 647
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 647
    Points : 11 136
    Points
    11 136
    Par défaut
    Bonjour;

    Code c : Sélectionner tout - Visualiser dans une fenêtre à part
    char server[] = "www.martin_valentin.fr";
    ça ne serait pas plutôt :
    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    char server[] = "http://www.martin_valentin.fr";

    Le port 80 de ton serveur est ouvert ?
    Egalement : pourquoi déconnecter ton client si c'est pour se reconnecter aussitôt le tour suivant ?

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Hey !

    Je me suis inspiré de ce tuto étape 4 : http://www.icreateproject.info/uncat...a-to-database/

    Je testerai avec char server[] = "http://www.martin_valentin.fr"; et oui ce n'est pas bête pour la fin de connexion

    Pour le port 80, je ne sais pas comment savoir si ce port est ouvert sachant que c'est un serveur hébergé chez 1&1.

  4. #4
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Même avec la modification cela ne fonctionne pas.

    Pour le port 80 je ne sais pas comment savoir.

    La carte ethernet est connecté sur un mini ordi sous windows XP.

    J'ai configuré le DHCP pour la carte arduino avec son adresse mac.

    Malgré ca, rien !

  5. #5
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 647
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 647
    Points : 11 136
    Points
    11 136
    Par défaut
    Le port 80 est le port http. Après réflexion, il n'y pas de raison pour qu'il soit fermé. J'ai comparé ton code et celui du tutoriel. Déjà il y a un client.close() en trop (ligne 111 dans ton code). Le délai est de 10 secondes dans le tuto, dans ton cas 200ms... C'est court.

    Tu es sûr qu'une connexion n'est pas réalisée au moins 1 fois, lors du démarrage de l'Arduino ?

    Par contre, ta configuration me laisse perplexe : l'Arduino est connecté au mini PC via le port réseau. Et le PC est connecté au net ? Le mini PC a 2 cartes réseau ?

  6. #6
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Des que le programme se lance, il m affiche connections failed en boucle.
    L'arduino est connecté sur le port Ethernet de l'ordinateur et l'ordi est connecté en wifi à ma box.

  7. #7
    Modérateur

    Avatar de Vincent PETIT
    Homme Profil pro
    Consultant en Systèmes Embarqués
    Inscrit en
    Avril 2002
    Messages
    3 189
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Consultant en Systèmes Embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Avril 2002
    Messages : 3 189
    Points : 11 571
    Points
    11 571
    Par défaut
    J'ai une question.

    Elle est où cette page http://www.martin_valentin.fr ?
    Tu héberges ça en local sur ton PC où est connecté ton Arduino ? Où c'est sur un vrai serveur internet ?

    Dans le tuto que tu as suivi, le gars ne semble pas être en local, d'où le "www" il me semble. Toi si tu es en local, n'est il pas plus pertinent de mettre l'adresse IP du PC ?
    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    char server[] = "192.168.x.x.x";
    Car tu n'as peut être pas de service DNS pour rediriger "martin_valentin.fr" => adresse IP du PC.
    Ton Arduino, ça il ne peut pas le savoir.
    La science ne nous apprend rien : c'est l'expérience qui nous apprend quelque chose.
    Richard Feynman

  8. #8
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Mon site est hébergé sur mon server distant 1&1 donc non en local.

  9. #9
    Modérateur

    Avatar de Vincent PETIT
    Homme Profil pro
    Consultant en Systèmes Embarqués
    Inscrit en
    Avril 2002
    Messages
    3 189
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Consultant en Systèmes Embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Avril 2002
    Messages : 3 189
    Points : 11 571
    Points
    11 571
    Par défaut
    Alors il y a un truc que je ne comprends pas.
    D'abord comment tu as résolu ton problème ? Cette discussion est résolue visiblement mais ta réponse pourrait aider d'autres personnes.

    Ensuite si ton site ainsi que la base est hébergé sur une serveur distant, et pas sur le PC, alors l'Arduino devrait être branché non pas sur l'Ethernet du PC mais sur celui de ta Box internet, ne serait ce que pour avoir accès aux services DNS pour trouver http://www.martin_valentin.fr !

    Ou bien ton PC fait passerelle / routeur ?
    La science ne nous apprend rien : c'est l'expérience qui nous apprend quelque chose.
    Richard Feynman

  10. #10
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Je m'étais trompé en cliquant sur résolu désolé.


    Mon site ainsi que la base est hébergé sur une serveur distant, et pas sur le PC. Mon Arduino est branché sur l'Ethernet du PC.
    La je ne veux que faire une requête HTTP GET sur mon serveur distant sans devoir branché mon arduino sur ma boxe.
    Je dois du coup le brancher directement sur ma box pour faire ca?
    Comment je peux faire sinon si ma box ne se trouve pas à coté du compteur EDF?

  11. #11
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 647
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 647
    Points : 11 136
    Points
    11 136
    Par défaut
    Je suis du même avis que Vincent, je pense qu'il faudrait brancher ton Arduino sur ta box (d'où ma question sur ta configuration). Sinon il te faudrait un proxy sur ton mini PC qui renvoie les données de l'Arduino vers le site en question.

  12. #12
    Modérateur

    Avatar de Vincent PETIT
    Homme Profil pro
    Consultant en Systèmes Embarqués
    Inscrit en
    Avril 2002
    Messages
    3 189
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Consultant en Systèmes Embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Avril 2002
    Messages : 3 189
    Points : 11 571
    Points
    11 571
    Par défaut
    Alors à moins que ton PC fasse routeur (pour router/diriger les requêtes de Arduino vers http://www.martin_valentin.fr au travers de la Box) ça ne fonctionnera jamais. Car ton PC ne peut pas savoir, sans une configuration adaptée, que Arduino souhaite faire ça.

    Par contre, si tu relis Arduino à la Box alors d'une part, la Box qui est un serveur va attribuer une adresse IP à Arduino. Ensuite lorsque Arduino va envoyer une requête vers http://www.martin_valentin.fr, la Box qui est un serveur va comprendre que Arduino souhaite aller sur internet (exactement de la même façon que si tu vas sur le net avec ton PC qui sous XP, la Box comprend que la requête "http" veut aller chercher un truc sur internet). Enfin la Box connaît un serveur DNS qui est on va dire une espèce de très grosse table de correspondance du genre :
    www.google.fr = adresse IP
    www.martin_valentin.fr = adresse IP
    ...
    ...

    Fait un essai sur la Box et à mon avis ça fonctionnera (avec des données bidons juste pour valider le fonctionnement.) Après je n'ai pas d'Arduino pour tester donc peut être qu'il y a des petites erreurs ici et là comme le souligne Auteur, je ne sais pas.
    Si ton compteur ERDF est trop loin de ta Box rassure toi, la câble téléreport/téléinfo peut être très très long (Je le sais je travaille chez ERDF, j'ai même bossé sur Soissons/Laon et un peu dans ton coin St Quentin)


    ajustement des termes suite à la remarque de Auteur voir motif de la modification (le réseau n'est pas du tout ma spécialité)
    La science ne nous apprend rien : c'est l'expérience qui nous apprend quelque chose.
    Richard Feynman

  13. #13
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Je trouve un cable ethernet assez long et je test ca

    Que pensez vous de cette méthode sinon :
    http://drcharlesbell.blogspot.fr/201...arduino_6.html

  14. #14
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Re !

    Bon en passant par la box, ca fonctionne !
    Ca se connecte une fois mais je ne reçois rien sur ma base.
    Ensuite j'ai le message en boucle 'connection failed'
    Voici le code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
     
    #include <SPI.h>
    #include <Ethernet.h>
     
    byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0xF9, 0x81 };
    IPAddress ip(192, 168, 1, 135);
     
    char server[] = "www.martin-valentin.fr";
    EthernetClient client;
     
    #include <SoftwareSerial.h>
    SoftwareSerial cptSerial(2, 3);
    #define startFrame 0x02
    #define endFrame 0x03
    #define startLine 0x0A
    #define endLine 0x0D
     
    void setup()
    {
      cptSerial.begin(1200);
      Serial.begin(9600);
      Ethernet.begin(mac, ip);
    }
     
    String GetTeleInfo()
    {
        String TeleInfo = "";
        char charIn = 0;
         while (charIn != startLine)
        {
            charIn = cptSerial.read() & 0x7F;
        }
        while (charIn != endLine)
        {
            if (cptSerial.available() > 0)
            {
                charIn = cptSerial.read() & 0x7F;
                TeleInfo += charIn;
            }
        }
        return TeleInfo;
    }
     
    String ShowTeleInfo(String keyword, String unit, int length)
    {
        int essai = 0;
        // Nombre d'étiquettes maximum, cf documentation ERDF
        int max_essais = 33;
        String data = "";
        String msg = "";
        while(data.substring(0,keyword.length()) != keyword && essai != max_essais)
        {
            data = GetTeleInfo();
            essai++;
        }
        msg = "\t<";
        msg += keyword;
        msg += " unit=\"";
        msg += unit;
        msg += "\">";
        if (essai != max_essais)
        {
            msg += data.substring((keyword.length() + 1),(length + (keyword.length() + 1)));
        }
        else
        {
            msg += "NA";
        }
        msg += "</";
        msg += keyword;
        msg += ">";
        return msg;
    }
     
    void loop()
    {
      boolean current_line_is_blank = true;
      if(client.connect(server, 80)) {
        Serial.println("-> Connected");
        char c = client.read();
        if (c == '\n' && current_line_is_blank)
        {
          client.print("GET /teleinfo/add_data.php?");
          client.print("ADCO=");
          client.print(ShowTeleInfo("ADCO","",12));
          client.print("&&");
          client.print("OPTARIF=");
          client.print(ShowTeleInfo("OPTARIF","",4));
          client.print("&&");
          client.print("ISOUSC=");
          client.print(ShowTeleInfo("ISOUSC","A",2));
          client.print("&&");
          client.print("BASE=");
          client.print(ShowTeleInfo("BASE","Wh",9));
          client.print("&&");
          client.print("HCHC=");
          client.print(ShowTeleInfo("HCHC","Wh",9));
          client.print("&&");
          client.print("HCHP=");
          client.print(ShowTeleInfo("HCHP","Wh",9));
          client.print("&&");
          client.print("EJPHN=");
          client.print(ShowTeleInfo("EJPHN","Wh",9));
          client.print("&&");
          client.print("EJPHPM=");
          client.print(ShowTeleInfo("EJPHPM","Wh",9));
          client.print("&&");
          client.print("BBRHCJB=");
          client.print(ShowTeleInfo("BBRHCJB","Wh",9));
          client.print("&&");
          client.print("BBRHPJB=");
          client.print(ShowTeleInfo("BBRHPJB","Wh",9));
          client.print("&&");
          client.print("BBRHCJW=");
          client.print(ShowTeleInfo("BBRHCJW","Wh",9));
          client.print("&&");
          client.print("BBRHPJW=");
          client.print(ShowTeleInfo("BBRHPJW","Wh",9));
          client.print("&&");
          client.print("BBRHCJR=");
          client.print(ShowTeleInfo("BBRHCJR","Wh",9));
          client.print("&&");
          client.print("BBRHPJR=");
          client.print(ShowTeleInfo("BBRHPJR","Wh",9));
          client.print("&&");
          client.print("PEJP=");
          client.print(ShowTeleInfo("PEJP","min",2));
          client.print("&&");
          client.print("PTEC=");
          client.print(ShowTeleInfo("PTEC","",4));
          client.print("&&");
          client.print("DEMAIN=");
          client.print(ShowTeleInfo("DEMAIN","",4));
          client.print("&&");
          client.print("IINST=");
          client.print(ShowTeleInfo("IINST","A",3));
          client.print("&&");
          client.print("IINST1=");
          client.print(ShowTeleInfo("IINST1","A",3));
          client.print("&&");
          client.print("IINST2=");
          client.print(ShowTeleInfo("IINST2","A",3));
          client.print("&&");
          client.print("IINST3=");
          client.print(ShowTeleInfo("IINST3","A",3));
          client.print("&&");
          client.print("IMAX=");
          client.print(ShowTeleInfo("IMAX","A",3));
          client.print("&&");
          client.print("IMAX1=");
          client.print(ShowTeleInfo("IMAX1","A",3));
          client.print("&&");
          client.print("IMAX2=");
          client.print(ShowTeleInfo("IMAX2","A",3));
          client.print("&&");
          client.print("IMAX3=");
          client.print(ShowTeleInfo("IMAX3","A",3));
          client.print("&&");
          client.print("PMAX=");
          client.print(ShowTeleInfo("PMAX","W",5));
          client.print("&&");
          client.print("PAPP=");
          client.print(ShowTeleInfo("PAPP","VA",5));
          client.print("&&");
          client.print("HHPHC=");
          client.print(ShowTeleInfo("HHPHC","",1));
          client.print("&&");
          client.print("MOTDETAT=");
          client.print(ShowTeleInfo("MOTDETAT","",6));
          client.print("&&");
          client.print("PPOT=");
          client.print(ShowTeleInfo("PPOT","",2));
     
          client.println(" HTTP/1.1");
          client.println("Host: www.martin-valentin.fr");
          client.println("Connection: close");
          client.println();
          client.println();
          /*client.stop();*/
          }
        if (c == '\n')
        {
            current_line_is_blank = true;
        }
        else if (c != '\r')
        {
            current_line_is_blank = false;
        }
      } else {
        Serial.println("--> connection failed\n");
      }
      delay(5000);
    }

  15. #15
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 647
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 647
    Points : 11 136
    Points
    11 136
    Par défaut
    Citation Envoyé par tintin02100
    Ca se connecte une fois mais je ne reçois rien sur ma base.
    A mon avis, pour tes tests tu devrais utiliser un script plus simple sans passer par une base SQL : juste afficher quelque chose sur ton site distant.

    Ensuite, pourquoi as-tu supprimé le client.stop() (ligne 178 du dernier code posté) ? Car si tu ne te déconnectes pas tu n'as pas à te reconnecter le tour suivant client.connect(server, 80) (ligne 77). Tu vois ce que je veux dire ?

  16. #16
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Bonjour,

    J'avais supprimé le 'client.stop()' afin de tester différentes possibilités. Sans succès.
    Je vais tenter d'afficher juste les valeurs sur une page

  17. #17
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    En local, ca passe mais pas sur serveur

  18. #18
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 647
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 647
    Points : 11 136
    Points
    11 136
    Par défaut
    Personnellement, je n'ai pas trop d'idées.
    Un problème d'IP (IP serveur) ? Le pare-feu ?

    Sinon de ton PC tu as programme qui te permet de te connecter à ton serveur et d'envoyer tes données ?

  19. #19
    Futur Membre du Club
    Homme Profil pro
    Aucune
    Inscrit en
    Mai 2014
    Messages
    28
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Aisne (Picardie)

    Informations professionnelles :
    Activité : Aucune

    Informations forums :
    Inscription : Mai 2014
    Messages : 28
    Points : 8
    Points
    8
    Par défaut
    Le plus simple c'est que je stocke en local sur mon ordi et que je crée une page qui envoie sur mon serveur... Mais en local
    Ainsi pas besoin de me brancher directement sur ma box.

    En gros j'avais cet exemple la qui était bien construit dont je me suis inspiré :
    https://blog.antoineve.me/2015/05/30...-avec-arduino/
    Cette page là pour envoyer get :
    http://www.icreateproject.info/uncat...a-to-database/

    Sinon j'ai ce choix là mais 1&1 ne donne pas l'ip des serveurs php. On ne pourrait apparemment y accéder qu'à partir de leur serveur... :
    http://drcharlesbell.blogspot.fr/201...arduino_6.html

  20. #20
    Modérateur

    Avatar de Bktero
    Homme Profil pro
    Développeur en systèmes embarqués
    Inscrit en
    Juin 2009
    Messages
    4 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur en systèmes embarqués

    Informations forums :
    Inscription : Juin 2009
    Messages : 4 481
    Points : 13 679
    Points
    13 679
    Billets dans le blog
    1
    Par défaut
    J'ai suivi en diagonale, désolé si la question a déjà été posée : ta carte arrive t-elle à se connecter à www.google.com par exemple ?

Discussions similaires

  1. pb de connexion sur mysql-server
    Par nora2311 dans le forum Administration
    Réponses: 10
    Dernier message: 06/01/2009, 17h16
  2. Chargement des données sur mysql
    Par ecom_adil dans le forum SQL Procédural
    Réponses: 0
    Dernier message: 25/02/2008, 17h08
  3. limitation de données sur SQL server / Access / MySQL
    Par alexfrei04 dans le forum Décisions SGBD
    Réponses: 4
    Dernier message: 06/02/2007, 15h43
  4. modéliser une base de données sur SQL Server ..
    Par Alexy3171 dans le forum MS SQL Server
    Réponses: 1
    Dernier message: 19/11/2006, 15h57
  5. Réponses: 3
    Dernier message: 27/04/2006, 10h01

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo