NeonMika / Markus VV. - Viewing Profile: Likes - Netduino Forums
   
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.

NeonMika / Markus VV.

Member Since 30 Sep 2011
Offline Last Active Oct 20 2015 11:25 AM
****-

#56643 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 05 March 2014 - 01:56 PM

So i just looked up some older posts and I think this one could help you: http://forums.netdui...ge-8#entry44189

 

There is the "default way" how to start a project using NeonMika.Webserver.

 

I'm pretty sure it has to do with the webserver-code. Have you tried to debug Server.cs? Setting a breakpoint in WaitingForRequest and stepping through the code with F5, F10 and F11 enables you to inspect the code in real detail (especially F11).

It would be very interesting at which point the error occurs.

Sorry that I cannot point out more at this point. but if you find the code-line on which the error accurs I can try to help further :)

 

You project sounds really cool! Would be really nice to see NeonMika.Webserver participate in such a big project. Please keep me updated how it works out! :)




#56631 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 04 March 2014 - 06:39 PM

Hi Michael,

first of all thanks for the kind words. I'm always happy when this project can help somebody to learn something new :)

 

Now the bad news: I cannot see what should be wrong with your code... I will have to grab my netduino and try it by myselft...

 

One thing i can tell you about C#:

ipAddress = "" + e.GetArguments["ip"];
subnetMask = "" + e.GetArguments["subnet"];
gateWay = "" + e.GetArguments["gateWay"];

could be replaced by

ipAddress = e.GetArguments["ip"].ToString();
subnetMask = e.GetArguments["subnet"].ToString();
gateWay = e.GetArguments["gateWay"].ToString();

This is more "best practice" and more readable. When concatinating a string with another "non-string"-object (in this case of type object I think), ToString() automatically gets called on the second object (That why you can write string foo = "myblablavariable" + 14; and don't have to write string foo = "myblablavariable" + (14).ToString())

 

Probably if you could post the exceptions thrown by a call of the method I could help you more.

 

This was also my first big project on networking and so I can't tell you if you have to do something before calling interf.EnableStaticIP(ipAddress, subnetMask, gateWay);

If we can't work it out I'm pretty sure Chris Walker can help us out, he's far more levels above me when it come to Micro Framework :P

 

A last question from my side: Why do you need the method?

When starting the server you can set the IP like in the following example:

Server WebServer = new Server(PinManagement.OnboardLED, 80, false, "192.168.0.200", "255.255.255.0", "192.168.0.1", "NETDUINOPLUS");

Just curious :)

 

Greets, Markus




#47994 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 03 April 2013 - 08:30 PM

Hello.

I removed some parts of the text in the first post and moved it to the Codeplex' documentation page:

http://neonmikawebse...m/documentation

 

I think it is more important to know what this webserver is all about than to know exactly how the code has to look.

If anybody has some tips on how to improve this thread I'm always happy to hear your ideas.

 

Greets, Markus




#47701 .net micro framework windows form

Posted by NeonMika / Markus VV. on 28 March 2013 - 07:53 PM

Reporting back in:

After one day full of nice work i can present the NeonMika.NetduinoControl as well as my client library for the NeonMika.Webserver.

 

http://forums.netdui...rclientlibrary/

 

Building up on this it should be easy for you to expand it to your needs :)

 

Greets, Markus




#47699 NeonMika.NetduinoControl & NeonMika.Webserver.ClientLibrary

Posted by NeonMika / Markus VV. on 28 March 2013 - 07:45 PM

Hello there Netduino-Community!

I'm proud to show you my new little baby:

https://netduinocontrol.codeplex.com/

 

The NeonMika.Webserver.ClientLibrary (I have to get shorter names :D)
as well as the NeonMika.NetduinoControl. Both can be downloaded via the codeplex link above.

This library supports to write client apps for the desktop for Netduino projects that use NeonMika.Webserver.
It was coded pretty straight forwarded because I didn't have that much time, but it works pretty well and should be easy to use.

In addition to the class library, I also wrote an application which allows to use all in-built webmethods of NeonMika.Webserver to control it.

The code for NeonMika.Webserver you can find here: http://neonmikawebserver.codeplex.com/
And the forum thread here: http://forums.netdui...nmikawebserver/

I hope this will help a lot of people who want to communicate with their Netduinos over ethernet. :)
 

Here is a video I made, but Youtube cut down the resolution, sorry:

And sorry for my bad English, haven't talk in it for about one year :P


I appreciate every feedback.

Greets, Markus




#47692 need help!

Posted by NeonMika / Markus VV. on 28 March 2013 - 06:31 PM

I will do it for... 

 

Thanks for this.

Making my day even better :D




#47671 How to generate a PWM signal with C#?

Posted by NeonMika / Markus VV. on 28 March 2013 - 06:46 AM

I use a Netduino+ (Version 1).

 

This is my code:

using SecretLabs.NETMF.Hardware.NetduinoPlus;using SecretLabs.NETMF.Hardware;using Microsoft.SPOT.Hardware;...//Output ports with PWM functionallity	    static private PWM PWM5 = new PWM(Pins.GPIO_PIN_D5);	    static private PWM PWM6 = new PWM(Pins.GPIO_PIN_D6);	    static private PWM PWM9 = new PWM(Pins.GPIO_PIN_D9);	    static private PWM PWM10 = new PWM(Pins.GPIO_PIN_D10);    

 

Have a look at your usings, probably you are missing something.

 

Attached File  References.jpg   21.7KB   51 downloads

Also be sure you have all references (picture above). Watch out. there is a Microsoft.SPOT.Hardware AND a Microsoft.SPOT.Hardware.PWM.

Both must be referenced.

 

Greets, Markus




#47670 .net micro framework windows form

Posted by NeonMika / Markus VV. on 28 March 2013 - 06:09 AM

Hi guys.

Thanks dave for mentioning the NeonMika.Webserver.

I will upload a basic communication client for my webserver this evening (for everyone not from europe: it'S 7am at the moment :P)

It is pretty easy, and my GUI application will provide some classes for easy communication with the NeonMika.Webserver.

Probably you want to have a look at it, i think it's a great way to make data available over ethernet.

 

Greets, Markus




#46059 Home Control with Netduino Plus 1

Posted by NeonMika / Markus VV. on 22 February 2013 - 12:39 PM

So here's the guy from NeonMika.Webserver :P

If you have any questions about it, just ask.

I think you could do this pretty easy with my webserver code. Just write a small method, probably called "ChangeSetting". This will have 2 Parameter: "Name" and "Value". And to change one of your Settings just call the URL. But it's all yours how you want to design the communication. But I think it shouldn't be hard to implement it.

 

Greets, Markus

 

EDIT: You could also generate the file on the PC side and just upload it to the SD Card via POST. :)




#45959 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 21 February 2013 - 10:40 AM

First of all, thanks a bunch for the webserver code Markus!! I think this code should be on every Netduino sold :)

 

I have a request, that is if it is not difficult for you to implement. 

 

Can you add a request to the server that returns all digital states. Like http://192.168.156.1...inState?pin=ALL ?

 

I'm creating an Android app that uses your webserver and it would be awesome to be able to get all the states in one request.

 

-Skarpi

 

Thanks for using my code... Here are some hints how you can implement it yourself in less than 5 minutes:

 

With having a look at the first post, you can find code how to write your own method:

 

private void Echo(RequestReceivedEventArgs e,Hashtable results){if(e.Request.GetArguments.Contains("value") == true)	results.Add("Echo",e.Request.GetArguments["value"]);else	results.Add("ERROR", "No 'value'-parameter transmitted toserver");} 


This is how you write a XMLResponse.

By using results.Add(name,value) you add an object to the response.

After you have written the method, you just have to add it to your webserver instance.

 

 

WebServer.AddResponse(newXMLResponse("echo", new XMLResponseMethod(Echo))); 

 

Now all you have to do is to change "echo" in the line above to "returnAllDigitalStates" or something like that... This will be the URL which you have to enter...

And instead of writing the Echo-Method you can write a ReturnAllDigitalStates method and add this one.

You don't need any "argument-checks" because you just have to call the URL without parameters :)

 

If you have further problems, just write here :)

 

Greets, Markus




#44767 N+(2) Aquarium Controller

Posted by NeonMika / Markus VV. on 02 February 2013 - 06:25 PM

Hey, I just stumbled upon this project and saw that it is using NeonMika.Webserver.

I have to admit, I've just read the first post and not the whole thread, but it sounds pretty cool.

 

I am far away from being a web programmer, and I work with sockets just from time to time when I need them in my spare time projects.

So could you tell me: What do you do exactly? Upload a file to the N+2, save it. Then you want to reboot the Netduino and when it's rebootet you want the page (which is stored on the N+2) to refresh? Hmmm...

 

Greets, Markus




#44189 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 25 January 2013 - 05:56 PM

Hey skobyjay,
I just updated my project structure to get the .dll names right.

But I would recommend you this way:
Create a project (Let's call it Foo)
Now you have a "Solution" with one project in it.
Now click on your Solution, "Add existing project"
Go to NeonMika.Webserver -> Framework -> NeonMika.Webserver -> NeonMika.Webserver -> NeonMika.Webserver.csproj
Now you can go to the Foo project, rightclick on references and say "Add reference"
Open the Tab "Projects", there you go.

If you really want to use the .dll, you can add a reference to Go to NeonMika.Webserver -> Framework -> NeonMika.Webserver -> NeonMika.Webserver -> bin -> Debug -> NeonMIka.Webserver.dll

If you use the version for Netduino+ 2 i also think you should use the NeonMika.Webserver.dll

Here you can find the latest version: http://neonmikawebse...ew/f916b3510096

Greets, Markus


#44051 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 23 January 2013 - 10:16 PM

Hey skobyjay,

 

Here is an example on how to SEND json:

 

 

	    /// <summary>	    /// Returns the responses added to the webserver	    /// </summary>	    /// <param name="e"></param>	    /// <param name="h"></param>	    /// <returns></returns>	    private void ResponseListJSON(Request e, JsonArray j)	    {		    JsonObject o;		    foreach ( Object k in _Responses.Keys )		    {			    if ( _Responses[k] as JSONResponse != null )			    {				    o = new JsonObject( );				    o.Add("methodURL", k);				    o.Add("methodInternalName", ( (Response)_Responses[k] ).URL);				    j.Add(o);			    }		    }	    }

As you can see, you just have to add some JsonObjects to the JsonArray j.

This JsonArray j will be sent to the client.

 

I you want to know a little more just have a look at JsonObject and JsonArray :)

 

On how to receive Json I cannot give you that much input, but I think it is not that hard to implement it.

You could work with some String.Split(), probably you also could use on of the frameworks mentioned here: http://www.json.org/

 

Greets, Markus

 

EDIT:

If it is enough to send some parameter to the webserver method, I would recommend you to send them in the URL.

You can use them this way:

 

 

if(e.GetArguments.Contains("pin")){   int pin = Convert.ToInt32(e.GetArguments["pin"]);   //Do something :P   //Add data to the JsonArray j}



#43281 NeonMika.Webserver

Posted by NeonMika / Markus VV. on 13 January 2013 - 05:04 PM

Hey guys!

 

First of all: You are awesome! So much interest in this webserver and the community helping each other. Thanks!

Second: Special thanks to Dave! I will sit down NOW and will include your N+2 version.

 

I'm pretty busy at university and work (yeah I had holidays, but I didn't think of my N+ :P)

 

Regarding the missing connections: I didn't want to use the Thread.Sleep(100) because I wanted to keep to "as fast as possible".

But I think it is better that it works than it is light-fast :P

 

Without debugging through the code I can only tell that I had the following code working to upload data to the Netduino:

 

 

try		    {			    // Create a request using a URL that can receive a post.			    WebRequest request = WebRequest.Create(ServerTextBox.Text);			    // Set the Method property of the request to POST.			    request.Method = "POST";			    // Create POST data and convert it to a byte array.			    FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);			    BinaryReader br = new BinaryReader(fs);			    byte[] byteArray = new byte[fs.Length];			    for (int i = 0; i < fs.Length; i++)				    byteArray[i] = br.ReadByte();			    // Set the ContentType property of the WebRequest.			    request.ContentType = "application/x-www-form-urlencoded";			    // Set the ContentLength property of the WebRequest.			    request.ContentLength = byteArray.Length;			    // Get the request stream.			    Stream dataStream = request.GetRequestStream();			    // Write the data to the request stream.			    dataStream.Write(byteArray, 0, byteArray.Length);			    // Close the Stream object.			    dataStream.Close();			    // Get the response.			    WebResponse response = request.GetResponse();			    // Display the status.			    System.Diagnostics.Debug.WriteLine(((HttpWebResponse)response).StatusDescription);			    // Get the stream containing content returned by the server.			    dataStream = response.GetResponseStream();			    // Open the stream using a StreamReader for easy access.			    StreamReader reader = new StreamReader(dataStream);			    // Read the content.			    string responseFromServer = reader.ReadToEnd();			    // Display the content.			    System.Diagnostics.Debug.WriteLine(responseFromServer);			    // Clean up the streams.			    reader.Close();			    dataStream.Close();			    response.Close();		    }		    catch (Exception ex)		    {			    MessageBox.Show(ex.ToString());		    }

I can imagine that a second (or even more) connection gets opened in the background. This only contains data or something like that. I don't exacly know how multi-part POST works. If I have a little more time, I will look into it, but at this point I can only provide this C# code.

 

Greats, Markus




#28490 Help about controll netduino with USB in the winfom app

Posted by NeonMika / Markus VV. on 03 May 2012 - 03:07 PM

I also did this some time ago with an Atmega microcontroller.
As you can read in the link Nevyn posted "Plugging this cable into the PC installed new drivers (on Windows 7) and created a new COM port for me."

So you don't "talk" with the Netduino over USB, but via "simulated" serial communication.

Greets, Markus




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.