Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

CT1

Member Since 17 Dec 2011
Offline Last Active Private
-----

Posts I've Made

In Topic: M2Mqtt Library

22 July 2015 - 11:21 AM

So back to my main problem. Is MQTT suppose to work on a NetduinoPlus v1 or am I just spinning my wheels?


I found an old example in the forum yesterday by Dan Anderson & I got it to work! So the answer is YES MQTT does work on the NetduinoPlus V1. Will need to figure out what I'm doing wrong on Paolo's version but for now I'm moving on to the other side of this project...the Android Phone

Thanks

In Topic: M2Mqtt Library

21 July 2015 - 12:30 PM

Thanks for the tip on the paste, couldn't get it to work for anything yesterday.

So back to my main problem. Is MQTT suppose to work on a NetduinoPlus v1 or am I just spinning my wheels?

Here's the error messages I'm currently getting

A first chance exception of type 'System.ArgumentException' occurred in System.dll
A first chance exception of type 'System.NotSupportedException' occurred in M2Mqtt.NetMf.dll
A first chance exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' occurred in M2Mqtt.NetMf.dll
An unhandled exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' occurred in M2Mqtt.NetMf.dll

In Topic: M2Mqtt Library

20 July 2015 - 10:07 PM

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages;
using System.Text;

namespace netduinoplus.app
{
    public class Program
    {
        public static void Main()
        {
            // create client instance 
            //MqttClient client = new MqttClient(IPAddress.Parse("iot.eclipse.org"));
            //MqttClient client = new MqttClient("85.119.83.194");
            //MqttClient client = new MqttClient("dev.rabbitmq.com", 1883, false, null);
            MqttClient client = new MqttClient("iot.eclipse.org", 1883, false, null);
 
 
            // register to message received 
            client.MqttMsgPublishReceived += client_MqttMsgPublishReceived; 
            client.MqttMsgSubscribed += client_MqttMsgSubscribed;
            client.MqttMsgUnsubscribed += client_MqttMsgUnsubscribed;
            client.MqttMsgPublished += client_MqttMsgPublished;

            client.Subscribe(new string[] { "sensor/temp" }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
            client.Publish("sensor/temp", Encoding.UTF8.GetBytes("10.1"));
            var state = client.Connect("netduino_Client", null, null, false, 0, false, null, null, true, 60);

            /*
            float temp = 80;
            while (true)
            {
                // get temperature value... 
                temp = temp + 1;
                // ...publish it to the broker 
                client.Publish("sensor/temp", Encoding.UTF8.GetBytes("10.1"));
                mqttClient.Publish(MQTT_TEMP_TOPIC, Encoding.UTF8.GetBytes(temp.ToString()));
                Thread.Sleep(10000);
            }

            */

            Thread.Sleep(Timeout.Infinite); 
        }
      

    public static void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
    {
        // access data bytes throug e.Message
        Debug.Print("Message: " + e.Message);
    }

    public static void client_MqttMsgUnsubscribed(object sender, MqttMsgUnsubscribedEventArgs e)
    {
        // write your code
        Debug.Print("Unsubscribed ");
    }

    public static void client_MqttMsgSubscribed(object sender, MqttMsgSubscribedEventArgs e)
    {
        // write your code
        Debug.Print("Subscribed ");
    }

    public static void client_MqttMsgPublished(object sender, MqttMsgPublishedEventArgs e)
    {
        // write your code
        Debug.Print("Published ");
    }   
    }
}

Ok, I'm making progress.  I learned how to include M2Mqtt in the project using NuGet. :)

 

I've recoded the netduino piece following Paolo's examples but am having a problem connecting 

A number of First Chance exceptions are coming up....

 

Can someone tell me the secret to getting Paste to work in this box?

Does MQTT work on the NetDuino Plus version 1?

thanks

 

 

 

 

 

 

 

 

 


In Topic: OneWire ALPHA

17 April 2015 - 11:18 AM

Thanks for the update I will definitely try this out!  


In Topic: OneWire ALPHA

16 April 2015 - 01:31 PM

Michael, I just read thru this 9 page thread only to realize one wire probably doesn't work with NetduinoPlus v1 4.2

I am also thinking about moving over to the Raspberry Pi and was wondering if you would us Mono C#?


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.