Netduino no “Console.WriteLine”, Console does not exist in current context

雨燕双飞 提交于 2019-12-05 01:17:27

There is no Console on embedded devices. Hence, as you found, you must use Debug.Print.

This is a common error -- a Console is the command line of your PC that you are using to develop your Microframework application, which runs on the device -- not the PC.

Debug.Print works because there is a debugger running that can and does communicate with the device. The output is generally directed to the Output window of your development PC. This is accomplished through the connection to the development board from the PC (Usually USB, or Serial Port.)

It is possible to write a separate Console application to accomplish this, but -- you would have to write the communications code, as well, which is not a good task for a beginner. (If you want to try, use the SerialPort object in .NET, but -- the one provided is just as good and already written.)

It's available in 3.0, 4.0. and 4.1 from System.Ext namespace (MFDpwsExtensions.dll assembly)

MSDN:

http://msdn.microsoft.com/en-us/library/ee432029.aspx

Aisac

as @kfuglsang said, I would use just Debug.WriteLine()

Don't forget to use using System.Diagnostics;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!