Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yun #210

Open
yveshanoulle opened this issue Oct 31, 2016 · 1 comment
Open

yun #210

yveshanoulle opened this issue Oct 31, 2016 · 1 comment

Comments

@yveshanoulle
Copy link

yveshanoulle commented Oct 31, 2016

I'm trying to send an MQT message from an arduino yun.
When I do this manually on the server, it works.
When I do it with this code, nothing happend .

I don't get any errors, yet I don't get any message either. I tried two different arduino's they both have the same result. (Nothing)
Most arduino examples are about receiving messages. that works. (I took that code out, tom minimize the testing)
Any idea's what I should check?

#include <PubSubClient.h>
#include <Wire.h>
#include <Bridge.h>
#include <BridgeClient.h>

IPAddress server(192, 168, 1, 122);

BridgeClient ethClient;
PubSubClient client(ethClient);

#define AName "165ARD"
char TemperatureFilterChar[20] =     "162ARD/Temperature/";
char Temperature[3] =     "23";

void setup() {
  Bridge.begin();

  Console.begin();
  client.setServer(server, 1883);
 
//  PubSubClient setClient (client)
  delay(5000);
  
  if (client.publish(TemperatureFilterChar,Temperature))
  {
   Console.println("published");
}   
}

void reconnect() {


  while (!client.connected()) {
      Console.println("Attempting MQTT connection...");
    if (client.connect(AName)) {
      Console.println("connected");

      client.publish(TemperatureFilterChar,Temperature);
    
    }
    else
    {
      Console.println("failed, rc=");
      Console.println(client.state());
      Console.println(" try again in 5 seconds");
      delay(5000);
    }
  }
}

void loop() {

   client.publish(TemperatureFilterChar,Temperature);

  delay(1000);
  
}
@knolleary
Copy link
Owner

What console output do you get?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants