--micro_out=._.NET Micro Framework-适用于软件人员的硬件-程序员宅基地

技术标签: python  java  字符串  人工智能  大数据  

--micro_out=.

--micro_out=.

I'm definitely a software person. I took EE in school and made an LED class, then a small computer like everyone else, and I know my volts and my amps for the most part, but that's about it. The limits of my skills are somewhere around adding an LED and some resistors to leech power off a USB adapter (which I recently did while working on the Hanselcade retro arcade build).

我绝对是软件人。 我在学校上了EE,并开了LED课,然后像其他所有人一样参加了一台小型计算机,我基本上了解我的伏特和安培,但是仅此而已。 我的技能极限是在添加LED和一些电阻器以关闭USB适配器的电源方面(我最近在进行Hanselcade复古街机构建时做了此操作)。

I look at hardware guys like Clint Rutkas in awe. I mean, seriously, who builds a T-shirt cannon from scratch for fun? Amazing.

敬畏地看着像Clint Rutkas这样的硬件专家。 我的意思是说,认真地说,谁从头开始建造T恤大炮是为了娱乐? 惊人。

Clint sent me a "Netduino" board today. It's similar to an Arduino board, except it uses the .NET Micro Framework. Micro you say? That's techie-speak for "tiny ass framework." I spoke to Colin Miller about this earlier in the year on video at Channel 9.

克林特今天给我寄了一个“ Netduino”板。 除了使用.NET Micro Framework之外,它类似于Arduino板。 微你说? 那是“小屁股框架”的技术代表。 我在今年早些时候通过第9频道的视频Colin Miller进行了交谈。

Remember my SPOT watch from 2004? That's Smart Personal Objects Technology, which is marketing-speak for "tiny ass framework." That watch is six years old (and still running nicely, sitting on my desk, in fact) and ran .NET.

还记得2004年的SPOT手表吗? 那就是Smart Personal Objects Technology,它在市场上被称为“小屁股框架”。 那只手表已经六岁了(实际上仍然很好地运行,坐在我的桌子上),并且运行.NET

Fast forward to today and I find myself plugging in this Netduino board to my computer and following Pete's Hello World Tutorial and I'm looking at this namespace.

快进到今天,我发现自己将这个Netduino板插入到我的计算机中,并遵循Pete的Hello World Tutorial ,我正在寻找这个名称空间。

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

使用Microsoft.SPOT; 使用Microsoft.SPOT.Hardware;

It's back!

回来了!

Ok, putting it all together in context. The Netduino is a board that's mostly Arduino compatible and has a published schematic (PDF here) so you could make one yourself, if you wanted. The .NET Micro Framework (or TinyCLR as some folks have called it) is literally that - it's a tiny CLR that runs .NET byte code. You can write C# and it'll run on tiny CPUs with tiny amounts of memory (like 64k or something similarly smallish.) It's been with us all this time, and there is an enthusiastic community built around it.

好的,将它们放在上下文中。 Netduino是一个与Arduino基本兼容的电路板,并具有已发布的原理图(此处为PDF ),因此您可以根据需要自己制作。 .NET Micro Framework(或某些人称为TinyCLR)的字面意义是-它是运行.NET字节码的微型CLR。 您可以编写C#,它将在具有少量内存(例如64k或类似的较小内存)的微型CPU上运行。这一直伴随着我们,并且围绕它建立了一个热情的社区。

The .NET Micro Framework 4.1 source is available, it's Open Source under the Apache 2.0 License. (Ya, the new Microsoft is freaking me out also. There's a lot of source that's quietly making its way out under increasingly liberal licenses.) There's lots of great details at Pete's blog.

可以使用.NET Micro Framework 4.1源,根据Apache 2.0许可,它是开放源。 (是的,新的Microsoft也在吓我一跳。在越来越自由的许可下,有很多消息来源悄悄地将其淘汰。) Pete的博客中有很多重要细节

Here's what a Netduino looks like:

Netduino的外观如下:

I'm going to think of some hardware ideas that I can build with this. I also have a more capable and fancy Tahoe II with a touch-screen, accelerometer, buttons and more. If you're looking to prototype something quick, or even build a complete system with an off-the-shelf board, do check it out! Here's what a Tahoe II looks like. Remember, all these boards use C# and .NET. It's amazing writing something for hardware using a language and framework I already know how to use. It literally gets me 80% of the way there from a learning curve perspective.

我将考虑一些可以以此为基础的硬件思想。 我还拥有功能更强大,更漂亮的Tahoe II ,配备触摸屏,加速度计,按钮等。 如果您希望快速制作原型,或者甚至使用现成的板构建完整的系统,请进行检查! 这就是Tahoe II的外观。 请记住,所有这些开发板都使用C#和.NET。 使用我已经知道如何使用的语言和框架为硬件编写一些东西真是太神奇了。 从学习曲线的角度来看,从字面上看,它可以让我80%地达到目标。

There's also the GHI Electronics EMX Development system, so there's a lot of choices.

还有GHI Electronics EMX开发系统,因此有很多选择。

With each of these boards (and others) you just need to get the Micro Framework 4.1, then the SDK for that specific board. It integrates into Visual Studio 2010. If you want to change the product, they are taking proposals in the .NETMF Forums.

对于这些板(和其他板),您只需要获取Micro Framework 4.1 ,然后获取该特定板的SDK。 它已集成到Visual Studio 2010中。如果要更改产品,他们将在.NETMF论坛中提出建议

Directly from Pete's blog:

直接来自Pete的博客

入门 (Getting Started)

What you'll need:

您需要什么:

  • Netduino (Scott: or some other .NET Micro Framework board)

    Netduino (斯科特:或其他一些.NET Micro Framework板)

  • USB Cable (early Netduino units come with the USB cable) (Scott: Usually a micro- or mini-USB)

    USB电缆(早期Netduino设备随附USB电缆) (斯科特:通常为微型USB或微型USB)

  • Visual Studio 2010 and the .NET Micro Framework 4.1 SDK  (you can use C# Express 2010 if you don't have Visual Studio)

    Visual Studio 2010和.NET Micro Framework 4.1 SDK (如果没有Visual Studio,则可以使用C#Express 2010)

  • Netduino SDK in 32 bit or 64 bit, depending on your host OS.

    Netduino SDK( 32位64位) ,具体取决于您的主机操作系统。

  • Optional: shields and starter kits to do cool things with netduino. Existing Arduino shields are compatible. A shield is just an add-on card that fits the pins on the board.

    可选:防护罩和入门套件,用于使用netduino进行散热。 现有的Arduino防护板兼容。 屏蔽层只是适合主板上引脚的附加卡。

The SDK installs a device driver for talking to the Netduino. Make sure you select the one with the appropriate bitness, and that you install it before connecting the Netduino to the PC. I installed the VS2010 bits before the SDK, but it shouldn't matter.

SDK安装了用于与Netduino对话的设备驱动程序。 将Netduino连接到PC之前,请确保选择具有适当位数的适配器,并进行安装。 我在SDK之前安装了VS2010,但没关系。

Once you plug in the Netduino, using the USB cable, you should see the device driver get installed, and the power LED on the board light up.

使用USB电缆插入Netduino后,应该会看到设备驱动程序已安装,并且板上的电源LED点亮。

莫尔斯电码的Hello World (Hello World with Morse Code)

Now I just have the Netduino for now, so I haven't got any attachments. If I was a hardware guy, I'm sure I'd go try to take apart a toaster or remote control and declare something like "this toaster just needs a one OHM resister on pin-out 5A so I can invert the voltage and it'll toast bread over Bluetooth" but I have no idea what that means. All I can do with the Netduino out of the box to flash its LED, as Pete points out:

现在我现在只有Netduino,所以没有任何附件。 如果我是硬件人员,我敢肯定,我会尝试拆开烤面包机或遥控器,并声明类似“此烤面包机只需要在引脚5A上安装一个OHM电阻器,这样我就可以反转电压了“将通过蓝牙烤面包”,但我不知道那是什么意思。 正如Pete所指出的,我可以使用Netduino开箱即用的所有功能来闪烁其LED。

public static void Main() 
{
OutputPort onboardLed = new OutputPort(Pins.ONBOARD_LED, false);

while (true)
{
onboardLed.Write(true);
Thread.Sleep(500);

onboardLed.Write(false);
Thread.Sleep(500);
}
}

Let's make it fancier. How about outputting string using Morse Code? Wikipedia says a dot is 100ms long and a dash is 300ms. How hard can it be?

让我们变得更奇特。 使用摩尔斯电码输出字符串怎么样? 维基百科说一个点长100毫秒,一个破折号长300毫秒。 它能有多难?

I could go to StackOverflow as they had a contest to see who could make the SMALLEST implementation that would take a string and output Morse Code. They have an extremely optimized (for lines of code) solution. But it's extremely silly. Certainly no more silly than me making an LED blink Morse Code as well, but I'd like to be able to actually read my code. ;)

我可以去StackOverflow,因为他们有一个竞赛,看谁可以做一个最小的实现,该实现需要一个字符串并输出莫尔斯电码。 他们有一个非常优化的(针对代码行)解决方案。 但这非常愚蠢。 当然,也比让我让LED闪烁摩尔斯电码更傻,但是我希望能够真正读取我的代码。 ;)

So, here's a naive 10 minutes solution using this guys' two arrays because I'm too lazy to type up the Morse myself. I could have use a Hashtable also, but two parallel arrays was fine too. The .NET Micro Framework, being micro, doesn't have everything the full framework has. However, being open source, it has taken contributions and version 4.1 includes a Hashtable implementation.

因此,这是一个使用这两个人的数组的10天幼稚解决方案,因为我太懒了,无法自己输入摩尔斯电报。 我也可以使用Hashtable,但是两个并行数组也可以。 微型的.NET Micro Framework并不具备完整框架的所有功能。 但是,它是开源的,它已经做出了贡献,并且4.1版包含一个Hashtable实现。

I can even debug directly connected to the board!

我什至可以直接将调试连接到板上!

Here's my sad little program (it was very easy!)

这是我悲伤的小程序(非常简单!)

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.Text;
using System.Collections;

namespace NetduinoApplication1
{
public class Program
{
public static void Main()
{
OutputPort onboardLed = new OutputPort(Pins.ONBOARD_LED, false);

while (true)
{
onboardLed.Write(false);

foreach (char c in " hello scott hanselman ")
{
string morse = ConvertTextToMorse(c);
Debug.Print(c + " = " + morse);
TransmitDotOrDash(onboardLed, morse);
}

}
}

private static Char[] Letters = new Char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', ' '};

private static String[] MorseCode = new String[] {".-", "-...", "-.-.",
"-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..",
"--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-",
"...-", ".--", "-..-", "-.--", "--..", "-----", ".----", "..---",
"...--", "....-", ".....", "-....", "--...", "---..", "----.", " "};

public static String ConvertTextToMorse(char c)
{
int index = -1;
index = Array.IndexOf(Letters, c);
if (index != -1)
return MorseCode[index];
return string.Empty;
}


public static void TransmitDotOrDash(OutputPort port, string dotordash)
{
foreach (char c in dotordash)
{
TransmitDotOrDash(port, c);
}
Thread.Sleep(300); //gap between letters
}

public static void TransmitDotOrDash(OutputPort port, char dotordash)
{
if (dotordash == ' ')
{
port.Write(false);
Thread.Sleep(700); //gap between words
}
else //it's something
{
port.Write(true);
if (dotordash == '.')
Thread.Sleep(100); //dot
else
Thread.Sleep(300); //dash
port.Write(false);
}
}
}
}

Here's the debug output as I flash "hello scott hanselman" from the board.

这是我从板上刷新“ hello scott hanselman”时的调试输出。

Debug Output from the Netduino Board

All it all, it really couldn't be much easier. Next I'll try to get the Tahoe II working and maybe make a game for the boys. Perhaps hook up a speaker and a proximity sensor and see if they can sneak up on it.

所有这一切,真的很容易。 接下来,我将尝试使Tahoe II正常工作,并可能为男孩们制作游戏。 也许挂上扬声器和接近传感器,看看它们是否可以潜入其上。

Related Links

相关链接

翻译自: https://www.hanselman.com/blog/the-net-micro-framework-hardware-for-software-people

--micro_out=.

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/cunfuxiao7305/article/details/109082245

智能推荐

while循环&CPU占用率高问题深入分析与解决方案_main函数使用while(1)循环cpu占用99-程序员宅基地

文章浏览阅读3.8k次,点赞9次,收藏28次。直接上一个工作中碰到的问题,另外一个系统开启多线程调用我这边的接口,然后我这边会开启多线程批量查询第三方接口并且返回给调用方。使用的是两三年前别人遗留下来的方法,放到线上后发现确实是可以正常取到结果,但是一旦调用,CPU占用就直接100%(部署环境是win server服务器)。因此查看了下相关的老代码并使用JProfiler查看发现是在某个while循环的时候有问题。具体项目代码就不贴了,类似于下面这段代码。​​​​​​while(flag) {//your code;}这里的flag._main函数使用while(1)循环cpu占用99

【无标题】jetbrains idea shift f6不生效_idea shift +f6快捷键不生效-程序员宅基地

文章浏览阅读347次。idea shift f6 快捷键无效_idea shift +f6快捷键不生效

node.js学习笔记之Node中的核心模块_node模块中有很多核心模块,以下不属于核心模块,使用时需下载的是-程序员宅基地

文章浏览阅读135次。Ecmacript 中没有DOM 和 BOM核心模块Node为JavaScript提供了很多服务器级别,这些API绝大多数都被包装到了一个具名和核心模块中了,例如文件操作的 fs 核心模块 ,http服务构建的http 模块 path 路径操作模块 os 操作系统信息模块// 用来获取机器信息的var os = require('os')// 用来操作路径的var path = require('path')// 获取当前机器的 CPU 信息console.log(os.cpus._node模块中有很多核心模块,以下不属于核心模块,使用时需下载的是

数学建模【SPSS 下载-安装、方差分析与回归分析的SPSS实现(软件概述、方差分析、回归分析)】_化工数学模型数据回归软件-程序员宅基地

文章浏览阅读10w+次,点赞435次,收藏3.4k次。SPSS 22 下载安装过程7.6 方差分析与回归分析的SPSS实现7.6.1 SPSS软件概述1 SPSS版本与安装2 SPSS界面3 SPSS特点4 SPSS数据7.6.2 SPSS与方差分析1 单因素方差分析2 双因素方差分析7.6.3 SPSS与回归分析SPSS回归分析过程牙膏价格问题的回归分析_化工数学模型数据回归软件

利用hutool实现邮件发送功能_hutool发送邮件-程序员宅基地

文章浏览阅读7.5k次。如何利用hutool工具包实现邮件发送功能呢?1、首先引入hutool依赖<dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.19</version></dependency>2、编写邮件发送工具类package com.pc.c..._hutool发送邮件

docker安装elasticsearch,elasticsearch-head,kibana,ik分词器_docker安装kibana连接elasticsearch并且elasticsearch有密码-程序员宅基地

文章浏览阅读867次,点赞2次,收藏2次。docker安装elasticsearch,elasticsearch-head,kibana,ik分词器安装方式基本有两种,一种是pull的方式,一种是Dockerfile的方式,由于pull的方式pull下来后还需配置许多东西且不便于复用,个人比较喜欢使用Dockerfile的方式所有docker支持的镜像基本都在https://hub.docker.com/docker的官网上能找到合..._docker安装kibana连接elasticsearch并且elasticsearch有密码

随便推点

Python 攻克移动开发失败!_beeware-程序员宅基地

文章浏览阅读1.3w次,点赞57次,收藏92次。整理 | 郑丽媛出品 | CSDN(ID:CSDNnews)近年来,随着机器学习的兴起,有一门编程语言逐渐变得火热——Python。得益于其针对机器学习提供了大量开源框架和第三方模块,内置..._beeware

Swift4.0_Timer 的基本使用_swift timer 暂停-程序员宅基地

文章浏览阅读7.9k次。//// ViewController.swift// Day_10_Timer//// Created by dongqiangfei on 2018/10/15.// Copyright 2018年 飞飞. All rights reserved.//import UIKitclass ViewController: UIViewController { ..._swift timer 暂停

元素三大等待-程序员宅基地

文章浏览阅读986次,点赞2次,收藏2次。1.硬性等待让当前线程暂停执行,应用场景:代码执行速度太快了,但是UI元素没有立马加载出来,造成两者不同步,这时候就可以让代码等待一下,再去执行找元素的动作线程休眠,强制等待 Thread.sleep(long mills)package com.example.demo;import org.junit.jupiter.api.Test;import org.openqa.selenium.By;import org.openqa.selenium.firefox.Firefox.._元素三大等待

Java软件工程师职位分析_java岗位分析-程序员宅基地

文章浏览阅读3k次,点赞4次,收藏14次。Java软件工程师职位分析_java岗位分析

Java:Unreachable code的解决方法_java unreachable code-程序员宅基地

文章浏览阅读2k次。Java:Unreachable code的解决方法_java unreachable code

标签data-*自定义属性值和根据data属性值查找对应标签_如何根据data-*属性获取对应的标签对象-程序员宅基地

文章浏览阅读1w次。1、html中设置标签data-*的值 标题 11111 222222、点击获取当前标签的data-url的值$('dd').on('click', function() { var urlVal = $(this).data('ur_如何根据data-*属性获取对应的标签对象

推荐文章

热门文章

相关标签