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.

Wayneio

Member Since 24 Mar 2013
Offline Last Active Jul 19 2014 09:10 AM
-----

Topics I've Started

Xively

07 September 2013 - 04:29 PM

Anyone have any experience with Xively? (used to be cosm / pachube apparantly)

 

This is the first I have seen of this, and it looks like it will improve a lot upon my current set up, whereby the netduino writes all the code to a device connected on LAN, because I should be able to use this anywhere in the world!

 

My main question is if there is a library for the code for this, or any sample code?

 

Thanks!


Write full website to browser

01 August 2013 - 06:02 PM

I'm using a web server to control devices in the house with the netduino. The code below writes a simple html page to the pc when typing in the netduinos ip address.

	    while (true)		    {			    Socket clientSocket = listenerSocket.Accept();			    bool dataReady = clientSocket.Poll(5000000, SelectMode.SelectRead);			    if (dataReady && clientSocket.Available > 0)			    {				    byte[] buffer = new byte[clientSocket.Available];				    int bytesRead = clientSocket.Receive(buffer);				    string request =				    new string(System.Text.Encoding.UTF8.GetChars(buffer));				    if (request.IndexOf("ON") >= 0)				    {					    outD7.Write(true);				    }				    else if (request.IndexOf("OFF") >= 0)				    {					    outD7.Write(false);				    }				    string statusText = "Light is " + (outD7.Read() ? "ON" : "OFF") + ".";				    string response = WebPage.startHTML(statusText, ip);				    clientSocket.Send(System.Text.Encoding.UTF8.GetBytes(response));			    }			    clientSocket.Close();		    }
public static string startHTML(string ledStatus, string ip)	    {		    string code = "<html><head><title>Netduino Home Automation</title></head><body> <div class="status"><p>" + ledStatus + " </p></div>        <div class="switch"><p><a href="http://" + ip + "/ON">On</a></p><p><a href="http://" + ip + "/OFF">Off</a></p></div></body></html>";		    return code;	    }

This works great, so I wrote a full jquery mobile website to use instead. But my problem is the jquery website only writes the html to the browser, with none of the JS/CSS files that are referenced in the HTML. How can I make sure the  browser reads all of these files?

 

The code I wrote to read the website from the SD is:

 private static string getWebsite()	    {		    try		    {			    using (StreamReader reader = new StreamReader(@"SDindex.html"))			    {				    text = reader.ReadToEnd();			    }		    }		    catch (Exception e)		    {			    throw new Exception("Failed to read " + e.Message);		    }		    return text;	    }

Broken Digital IO?

31 July 2013 - 08:45 PM

I have just bought and soldered together a relay board and connected it in between an extension lead. The netduino is connected to the relay, and for testing, when I press the button on the netduino it should output on port 13 a 3.3v that should switch the relay.

 

My problem is that when i press the button on the netduino, nothing happend! So i connected the wire that controls the relay to the 3.3v output on the netduino and it switched. So that made me think the problem must be that there is no voltage coming from port 13.

 

I tested the output using a multimeter, and sure enough there is no voltage from port 13 when pressing the button. I've tried 4 different GPIO ports.

 

Have I broken my netduino, so it no longer outputs voltage out the GPIO ports??

 

The simple code is below:

 (by the way, the onboard LED turns on with button press, so i know the code is running.

  InputPort btn = new InputPort(Pins.ONBOARD_BTN, false, Port.ResistorMode.Disabled);		    OutputPort out13 = new OutputPort(Cpu.Pin.GPIO_Pin13, false);		    OutputPort outLED = new OutputPort(Pins.ONBOARD_LED, false);		    bool buttonState = false;		    while (true)		    {			    buttonState = btn.Read();			    out13.Write(buttonState);			    outLED.Write(buttonState);		    }

'DirectoryInfo' could not be found

29 July 2013 - 06:41 PM

I can't seem to delete this thread?


Controling Mains Power (UK)

28 July 2013 - 12:00 PM

Hi, I'm looking at controlling mains appliances with a netduino.

 

Will this product work for UK power (240V)? http://www.seeedstud...ield-p-693.html

I assume it's pretty simple in terms of code, just turning the relay on and off?

 

Also, from anyone's experience, is it still easy to access the other Digital IO ports for controlling other items?


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.