{"id":30,"date":"2011-06-26T17:19:25","date_gmt":"2011-06-26T15:19:25","guid":{"rendered":"http:\/\/jcoder.me\/blog\/?p=30"},"modified":"2011-06-26T17:19:25","modified_gmt":"2011-06-26T15:19:25","slug":"netduino-traffic-light","status":"publish","type":"post","link":"https:\/\/jcoder.me\/blog\/2011\/06\/26\/netduino-traffic-light\/","title":{"rendered":"Netduino Traffic Light"},"content":{"rendered":"<p>Last week I got my <em>GHI FEZ Internet of Things Kit<\/em>, which includes &#8211; besides many accessory parts &#8211; a .NET-Microframework-powered Arduino-like board, the Netduino.<\/p>\n<p>I started playing around with both the software and hardware, and the first thing that really worked was a very simple traffic light. It displays the light sequence <strong><span style=\"color: #ff0000;\">red<\/span><\/strong>, <span style=\"color: #ff0000;\"><strong>red<\/strong><\/span>\/<span style=\"color: #ff9900;\"><strong>yellow<\/strong><\/span>, <strong><span style=\"color: #339966;\">green<\/span><\/strong>, <strong><span style=\"color: #ff9900;\">yellow<\/span><\/strong> and back to <span style=\"color: #ff0000;\"><strong>red<\/strong><\/span> which is used in Germany. Although it is not that spectacular I&#8217;ve uploaded a short video showing the hardware setup and the light sequence.<\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.vimeo.com\/video\/25623224?title=0&amp;byline=0&amp;portrait=0\" width=\"580\" height=\"326\" frameborder=\"0\"><\/iframe><\/p>\n<p>This is the very simple code behind it:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nusing System;\r\nusing System.Threading;\r\nusing GHIElectronics.NETMF.FEZ;\r\nusing Microsoft.SPOT;\r\nusing Microsoft.SPOT.Hardware;\r\n\r\nnamespace NetduinoTrafficLights\r\n{\r\n    public class TrafficLightsDE\r\n    {\r\n        public static OutputPort Red = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di1, false);\r\n        public static OutputPort Yellow = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di0, false);\r\n        public static OutputPort Green = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di3, false);\r\n\r\n        public static void Main()\r\n        {\r\n            while (true)\r\n            {\r\n                Red.Write(true);\r\n                Thread.Sleep(6000);\r\n\r\n                Yellow.Write(true);\r\n                Thread.Sleep(1000);\r\n\r\n                Red.Write(false);\r\n                Yellow.Write(false);\r\n                Green.Write(true);\r\n                Thread.Sleep(8000);\r\n\r\n                Green.Write(false);\r\n                Yellow.Write(true);\r\n                Thread.Sleep(2000);\r\n\r\n                Yellow.Write(false);\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n<\/pre>\n<p>Over the next weeks and month I will play around with more of the kit&#8217;s accessory parts and I&#8217;ll continue posting code (and maybe videos) about that. If you like (or don&#8217;t like) the video, feel free to leave a comment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I got my GHI FEZ Internet of Things Kit, which includes &#8211; besides many accessory parts &#8211; a .NET-Microframework-powered Arduino-like board, the Netduino. I started playing around with both the software and hardware, and the first thing that &hellip; <a href=\"https:\/\/jcoder.me\/blog\/2011\/06\/26\/netduino-traffic-light\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6,4],"tags":[8,7,51,10],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-coding","category-netduino","category-netmf","tag-c","tag-fez","tag-netduino","tag-traffic-light"],"_links":{"self":[{"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":7,"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/posts\/30\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jcoder.me\/blog\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}