The second installment of my Coding4Fun column "Some Assembly Required" is up. It's called "It's Getting Hot In Here." This week I use Phidgets to measure the temperature in my cube, but I also interface with a temperature Web Service to find out the temperature outside. Then with some poorman's GDI and WinForms I chart the results over time. There's also a simple plugin system using Reflection and a shared Interface that allows one to add other temperature providers.
我的Coding4Fun列“需要某些组装”的第二部分已经到了。 它被称为“这里越来越热”。 本周,我使用Phidgets测量立方体中的温度,但是我还与温度Web服务进行交互以找出外部温度。 然后用一些穷人的GDI和WinForms将结果绘制成图表。 还有一个使用Reflection和共享接口的简单插件系统,该接口允许添加其他温度提供程序。
(An interesting extension plugin would be one that pulls the current temperature from the motherboard and CPU on-board sensors and compares it to the ambient temperature inside and outside. There's lots of possibilities.)
(一个有趣的扩展插件可能是从主板和CPU板载传感器获取当前温度并将其与内部和外部环境温度进行比较的插件。有很多可能性。)
The Coding4Fun site is of course, about fun, but it's also about presenting basic programming concepts to hobbyists who may not be totally familiar with concepts like OOP or Interface-oriented programming. I try to sneak in a few little tips and tricks to move folks who may not be programmers for a living in the direction of good (or decent) design.
Coding4Fun网站当然是有趣的,但它也向无法完全熟悉OOP或面向接口编程等概念的爱好者介绍了基本的编程概念。 我试图偷偷摸索一些小技巧,使那些可能不是程序员的人朝着良好(或体面)设计的方向发展。
The code isn't perfect or pristine, but it works, and it works pretty well. The Phidgets are a blast to work with, and I hope to move beyond this simple example and perhaps write a robot or a security system or something. I highly recommend them for prototyping any hardware projects you've been putting off. If you're a high-school computer teacher this kind of equipment could introduce coding to a much wider groups of students that would typically be interested.
该代码不是完美的或原始的,但它可以工作,并且效果很好。 Phidgets是一个爆炸性的工作,我希望超越这个简单的示例,也许编写一个机器人或安全系统之类的东西。 我强烈推荐它们用于原型化您一直拖延的任何硬件项目。 如果您是高中计算机老师,则此类设备可能会将编码引入更多通常会感兴趣的学生群体。
翻译自: https://www.hanselman.com/blog/new-coding4fun-article-its-getting-hot-in-here