Git Product home page Git Product logo

Comments (17)

jhagberg avatar jhagberg commented on July 20, 2024

Why this

#include
#include

?

What is your error?

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

it's SPI.h and WiFly.h

it's just disconnecting, no data retrieved

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

But the Wifly module gets ip adress and you can ping that and so on? I have never tried client mode just server. Is any example working?

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

Test this
https://github.com/sparkfun/WiFly-Shield/blob/master/Libraries/WiFly_Shield/examples/WiFly_WebClient/WiFly_WebClient.ino

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

this the only example thats working for me, i put the IP since the DNS resolution for this website is not great,

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

oki so try the http get from a telnet client to your host and see what you get.

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024
telnet 54.84.79.112 80
Trying 54.84.79.112...
Connected to 54.84.79.112.
Escape character is '^]'.
GET /api/emotions/primary/totals HTTP/1.1
Host: wefeel.csiro.au
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Server: Jetty(8.1.14.v20131031)

80
{"love":2820658,"other":6660280,"sadness":7162856,"anger":2557674,"joy":21272805,"*":35758370,"surprise":1800489,"fear":1183795}
0

Works for me.

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

code?

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

Try this then. I have not tested may not compile. but you need to send hostname.

// (Based on Ethernet's WebClient Example)

#include <SPI.h>
#include <WiFly.h>

#include "Credentials.h"


byte server[] = { 54,84,79,112}; // Google

//Client client(server, 80);

WiFlyClient client("wefeel.csiro.au", 80);

void setup() {

  Serial.begin(9600);

  WiFly.begin();

  if (!WiFly.join(ssid, passphrase)) {
    Serial.println("Association failed.");
    while (1) {
      // Hang on failure.
    }
  }  

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /api/emotions/primary/totals HTTP/1.1");
    client.println("Host: wefeel.csiro.au");
    client.println();
  } else {
    Serial.println("connection failed");
  }

}

void loop() {
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;)
      ;
  }
}

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

compiling by connection is failing

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

oki change

WiFlyClient client("wefeel.csiro.au", 80);

to

WiFlyClient client(server, 80);

and try again

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

That worked great, thanks for your help

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

Whooo. Good luck!

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

sorry, one more question, I'm trying to rerun the script in a loop, but it won't give the same results, any ideas?

from wifly-shield.

jhagberg avatar jhagberg commented on July 20, 2024

Why?
What is your result?

how does your code look like now?

from wifly-shield.

zeyaddeeb avatar zeyaddeeb commented on July 20, 2024

Here is the code, i'm not getting any connection at all

#include <SPI.h>
#include <WiFly.h>

#include "Credentials.h"

byte server[] = { 54,84,79,112}; // Google

//Client client(server, 80);

WiFlyClient client(server, 80);

void setup() {

Serial.begin(9600);

WiFly.begin();

if (!WiFly.join(ssid, passphrase)) {
Serial.println("Association failed.");
while (1) {
// Hang on failure.
}
}

Serial.println("connecting...");
delay(2000);
}

void loop() {
if (client.connect()) {
Serial.println("connected");
Serial.println("Getting the World's Mood");
delay(2000);
client.println("GET /api/emotions/primary/totals HTTP/1.1");
client.println("Host: wefeel.csiro.au");
client.println();
client.read();
} else {
Serial.println("connection failed");
}
while (client.connected())
{
if (client.available()) {
char c = client.read();
Serial.print(c);
delay(25000);
client.flush();
client.stop();
delay(25000);
}
}
setup();
delay(2000);
}

from wifly-shield.

ToniCorinne avatar ToniCorinne commented on July 20, 2024

Closing this issue out due to inactivity.

For anyone still looking for support on this product, we have moved this library to here, and have modified the code.

from wifly-shield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.