Edi Wang

Microsoft MVP for Azure

Windows

Using stepper motor in Windows 10 IoT Core

If you need to precisely control the rotation angle of the equipment, ordinary motors can't do it, usually we use stepper motors. For example, the 28BYJ-48 model is easy to buy. The stepper motor has to be used with the driver board, and the most commonly used is the driver board ULN2003 the chip, as shown in the figure below. However, note that the driver board you buy may not look the same, but it doesn't matter, as long as the chip is written on the ULN2003, you can use it, and their interfaces are the same.
Windows IoT Raspberry Pi

Sound Controlled Light by Windows 10 IoT Core

In many buildings, there are sound controlled light in use. When you clap your hands, the light turns on. Now, with Raspberry Pi 3 and Windows 10 IoT, we can make a sound controlled light ourselves. The sound sensor I use is FC-04. As other sensors, the first step is calibration. 1. Calibration for FC-04 Sound Sensor In quiet environment. Connect VCC to DC 3.3V,GND to Ground. At that time, the …
Windows UWP IoT Raspberry Pi

Windows 10 IoT: Detect Range with HC-04 Ultrasonic Sensor on Raspberry Pi 3

HC-04是树莓派上用的比较广泛的超声波传感器,可以用来测量设备和物体之间的距离。可惜网上的资料很少有针对Windows 10的,几乎都是Python和C在Linux上的例子。 hackster.io上有一篇用HC-04做雷达的例子,但是设计的部件太多了,对单纯学习HC-04传感器的使用来说这个例子比较复杂。搜了一圈,英文资料最好的是这篇:http://www.guruumeditation.net/en/digital-io-with-windows-10-iot-raspberry-pi-2-and-the-ultrasonic-ranging-module-hc-sr04/ 国内中文资料介绍Windows 10上HC-04传感器的文章似乎还没有,所以就简单总结一下步骤。 一、物理连接 对于没有多少物理和电子知识基础的人(比如我)来说,第一步连线是比较难的。很多文章都一笔带过说“这很 …
Windows UWP IoT Raspberry Pi

Windows 10 IoT Development: Moisture Sensor for Raspberry Pi 3

I bought a moisture sensor like this recently. After some research, there seem no articles to indicate how to use it in Windows 10. So I figured out myself. This sensor has 4 Pins, which are: PIN Usage AO Analog Out DO  Digital Out GND  Ground  VCC  Power So, let's connect VCC to DC3.3v on RPi, I use PIN 01. Connect GND to any ground header, which I use …
Windows UWP IoT Raspberry Pi

GY-30 (BH1750FVI) Light Sensor with Windows 10 IoT

I purchased a GY-30 light sensor recently, this model is also known as "BH1550FVI". There seems no sample for this sensor on Windows 10 yet, so I tried to make one. The light sensor looks like this: My board is a Raspberry Pi 3, the GPIO layout is shown in this table: Because GY-30 is an I2C device, so we can not use GPIO to drive it directly, we must use the I2C ports. In addition, …
Windows UWP IoT Raspberry Pi

Windows 10 IoT开发:UWP应用调用关机和重启命令

UWP通常是没有让设备关机和重启的权限的。但是在Windows 10 IoT Core中是有办法实现的。安装Windows 10 Iot Core之后默认启动的那个欢迎页面右上角是有关机和重启按钮的。其实就是个UWP,它的源代码在:https://github.com/ms-iot/samples/tree/develop/IoTCoreDefaultApp  分析源代码可以发现,关机和重启是通过ShutDownManager这个class实现的。 #region Assembly Windows.System.SystemManagementContract, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime // C:\Program Files (x86)\ …
Windows UWP IoT

Azure Remote Controlled Light with Windows 10 IoT Core

For those who have watched the "Big Bang Theory", you would probably remember that those physicists build an Internet controlled lamp. The signal send from their laptop traveled around the world and come back to their house to light up the lamp. Now, with Windows 10 IoT Core and Microsoft Azure, we could also achieve the same thing on a Raspberry Pi 3. First, I strongly recommend you to read …
Windows Azure IoT Raspberry Pi

Windows 10 UWP开发:如何不让界面卡死

自从.NET 4.5开始,C#多了一对新的异步关键词 async 和 await,如果不了解的朋友可以简单的看下下面的示意图。 简单的说,就是在通常情况下,用户在界面上进行的操作,比如点击一个按钮之后,如果进行大量的计算,或者读写文件、网络请求等耗时的操作,那么程序的界面就会卡住,在这段时间里,任何交互都不会响应,直到后台的代码执行完毕才会继续响应用户操作。 这种现象和你的应用是不是UWP没有什么卵关系,WinForm,WPF,Windows Phone SL/RT应用都会有这个问题。 这个问题的原因是因为这些耗时的操作和界面(UI线程)没有关系,但却在UI线程上执行了。解决办法就是另起一个线程,让它在UI线程之外去执行代码,这样就不会锁死UI。就像这图: 在.NET 4.5以前,要进行一个异步操作写法有点繁琐,.NET 4.5以后。我们只要把一个方法的签名声明为 …
Windows Async Async Await UWP

Windows 10 UWP开发:页面导航及后退的处理技巧

这篇文章主要总结一下Windows 10 UWP开发中关于页面导航及后退按钮的一些省时省力的技巧。 一、页面导航 导航到另一个页面,用的是Frame的Navigate方法,parameter参数是可选的: public System.Boolean Navigate(Type sourcePageType, System.Object parameter); 比如你的目标页面是TargetPage.xaml,通常类型就是TargetPage,所以就可以这样搞: Frame.Navigate(typeof(TargetPage), ParametersObject); 在目标页面接受参数,用的是OnNavigatedTo,然后把e.Parameter转换成你的参数类型,再自己撸一下就好,比如: protected override void OnNavigatedTo(
Windows UWP

How to Make Circular Avatar in Windows 10 UWP

Once upon a time, all user's avatar used to be square. Since Apple's design, now a lot of apps and websites would use a circular avatar instead of a squre one. This is how we used to make square avatar: Starting from Windows 10, Microsoft became the biggist Apple fans, so they changed avatars to circular in Windows system. So how can we make one in XAML without acutally cropping the …
Windows UWP