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.
Photo

Read Debug.Print() output without Visual Studio


  • Please log in to reply
8 replies to this topic

#1 GallySoft

GallySoft

    New Member

  • Members
  • Pip
  • 3 posts

Posted 08 April 2011 - 09:24 AM

Hi all. I need to read the Debug.Print() output of an application running in Netduino from a PC connected to it via USB without Visual Studio (not in debug, then). Is it possible? Thank you!

#2 José Ángel

José Ángel

    Advanced Member

  • Members
  • PipPipPip
  • 39 posts
  • LocationSpain

Posted 11 April 2011 - 08:57 PM

No, right now it's not supported. The usb connection is only available to deploy and debug the apps with Visual Studio :(

#3 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 11 April 2011 - 09:30 PM

Well, actually it's possible in two ways:

Copy the contents in "C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools" to the PC and start mfdeploy.exe
Select the device (USB->Netduino_Netduino) and press F5.

That's one way. The other way is to use serial deployment and a terminal client. Get your netduino connected serially to the PC and follow the instructions at this thread.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 12 April 2011 - 06:27 AM

You can also hook into the MFDeployEngine (the same thing that MFDeploy does) and tap into the Netduino's Debug.Print USB output stream. Chris

#5 Michel Trahan

Michel Trahan

    Advanced Member

  • Members
  • PipPipPip
  • 155 posts

Posted 12 April 2011 - 01:28 PM

You can also hook into the MFDeployEngine (the same thing that MFDeploy does) and tap into the Netduino's Debug.Print USB output stream.

Chris, I want to know how to do that ...

I want to start playing with Accel/Magneto/Gyro sensors and display on screen the resulting position/velocity ... (saw it many times but still wonder how to do it) ... graphically at that too ... any suggestions ?
Started with C in 1985, moved to Vb3 ... to vb6 and stopped. Now started with .Net and learning C# and VB.net and wishing VB.net was on MF !

#6 Jarek Andrzejewski

Jarek Andrzejewski

    New Member

  • Members
  • Pip
  • 2 posts
  • LocationPoland, Lodz

Posted 17 September 2012 - 10:24 PM

I just wrote a bit of code.

The PC part:
- add reference to C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools\MFDeployEngine.dll
- add reference to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.Build.Utilities.v4.0.dll
- target to .NET Framework 4 (not .NET 4 Client Profile)

Code draft (it's just a simple Windows Form with a textbox on it):

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Microsoft.NetMicroFramework.Tools.MFDeployTool.Engine;

namespace WindowsFormsApplication1 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            using (MFDeploy mfd = new MFDeploy()) {
                IList<MFPortDefinition> portDefs = mfd.EnumPorts(TransportType.USB);
                dev = mfd.Connect(portDefs[0]);
                dev.OnDebugText += new EventHandler<Microsoft.NetMicroFramework.Tools.MFDeployTool.Engine.DebugOutputEventArgs>(dev_OnDebugText);
            }
        }

        MFDevice dev;


        void dev_OnDebugText(object sender, Microsoft.NetMicroFramework.Tools.MFDeployTool.Engine.DebugOutputEventArgs e) {
            MethodInvoker action = delegate { textBox1.Text += e.Text; };
            textBox1.BeginInvoke(action);
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e) {
            dev.Dispose();
        }
    }
}

and every Debug.Print in Netduino code will update the textbox.
Of course production app needs some code to manage connection issues (e.g. no device connected).

It should be quite easy now to send specific data records from .NET MF to "full" .NET Framework on PC using USB 9at least one way).

--
Kind Regards,
Jarek Andrzejewski

P.S. Hello, Netduino Community (it's my first post).
--
Kind Regards,
Jarek Andrzejewski

#7 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 18 September 2012 - 06:09 AM

Kind Regards,
Jarek Andrzejewski

P.S. Hello, Netduino Community (it's my first post).

Hi Jarek and welcome to the community! Nice first post! :D
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 September 2012 - 06:14 AM

That is a great first post! Welcome, Jarek! Chris

#9 Christopher Clark

Christopher Clark

    Member

  • Members
  • PipPip
  • 18 posts
  • LocationNorth Carolina, USA

Posted 18 September 2012 - 04:23 PM

You can also hook into the MFDeployEngine (the same thing that MFDeploy does) and tap into the Netduino's Debug.Print USB output stream.

Chris


Suggest looking at this http://msdn.microsof...ce_members.aspx

There is an event you can capture Debug Text.

Update: Ah, too late, already a program above :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.