{"id":108,"date":"2012-08-13T23:39:58","date_gmt":"2012-08-13T14:39:58","guid":{"rendered":"http:\/\/www.u2-life.net\/ss\/?p=108"},"modified":"2012-08-13T23:41:32","modified_gmt":"2012-08-13T14:41:32","slug":"arduino%e3%82%92swf%e3%81%8b%e3%82%89%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"http:\/\/www.u2-life.net\/ss\/blog\/2012\/08\/13\/arduino%e3%82%92swf%e3%81%8b%e3%82%89%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab\/","title":{"rendered":"Arduino\u3092swf\u304b\u3089\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb"},"content":{"rendered":"<p>Arduino\u3092Flash(swf\uff09\u304b\u3089\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3057\u3066\u307f\u305f\u3002<\/p>\n<p><a href=\"http:\/\/garretlab.web.fc2.com\/arduino\/introduction\/flash\/index.html\" title=\"Flash\u304b\u3089\u4f7f\u3046\">\u201dFlash\u304b\u3089\u4f7f\u3046\u201d<\/a>\u304c\u3059\u3054\u304f\u53c2\u8003\u306b\u306a\u3063\u305f<\/p>\n<p>\uff11\uff0eFlashDevelop\u3067\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\uff12\uff0e\u4e0a\u8a18\u30b5\u30a4\u30c8\u306b\u3042\u308b\u3088\u3046\u306b\u3001\u30b7\u30ea\u30a2\u30eb\u30dd\u30fc\u30c8\u306e\u307f\u6ce8\u610f\u3057\u3066\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8abf\u6574\u3059\u308b\u3002<br \/>\n\uff13\uff0e\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u307f\u305f\u3044\u969b\u306b\u306f\u3001SWF\u304c\u5410\u304d\u51fa\u3055\u308c\u308b\u5834\u6240\u3068\u540c\u3058\u3068\u3053\u308d\u306b\u753b\u50cf\u3092\u914d\u7f6e\u3059\u308b<br \/>\n\u3000\uff08\u4e0b\u8a18\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u3001test.jpg)<br \/>\n\uff14\uff0eSWF\u306e\u30b5\u30a4\u30ba\u3084\u9ad8\u3055\u3082\u8abf\u7bc0\u3067\u304d\u308b\uff08SWF[&#8230;\u3092\u53c2\u7167\uff09<\/p>\n<p>\u4f5c\u3063\u305f\u306e\u306f\u3053\u306e\u7a0b\u5ea6\u306e\u30b5\u30f3\u30d7\u30eb\u3002\u3053\u308c\u3092FlashDevelop\u3067\u30c6\u30b9\u30c8\u3057\u3066\u30d3\u30eb\u30c9\u3059\u308b\u3068\u826f\u3044\u3002<br \/>\n<code><br \/>\npackage {<br \/>\n\t\timport flash.display.Loader;<br \/>\n        import flash.display.Sprite;<br \/>\n        import flash.events.TimerEvent;<br \/>\n\t\timport flash.net.URLRequest;<br \/>\n        import flash.utils.Timer;<br \/>\n        import net.eriksjodin.arduino.Arduino;<\/p>\n<p>[SWF(width=\"500\", height=\"500\", backgroundColor=\"0xFFCC00\")]<\/p>\n<p>        public class Main extends Sprite {<br \/>\n                private var arduino:Arduino;<br \/>\n                private var pin:int;<br \/>\n                private var timerEvent:Timer;<\/p>\n<p>                public function Main() {<br \/>\n                        timerEvent = new Timer(100);<br \/>\n                        timerEvent.addEventListener(TimerEvent.TIMER, onTick);<br \/>\n                        timerEvent.start();<br \/>\n\/\/Insert Picture<br \/>\n\t\t\t\t\t\tvar img1:Loader = new Loader();<br \/>\n\t\t\t\t\t\tvar theUrl:URLRequest = new URLRequest(\"test.jpg\");<br \/>\n\t\t\t\t\t\timg1.load(theUrl);<br \/>\n\t\t\t\t\t\timg1.x = 0;<br \/>\n\t\t\t\t\t\timg1.y = 0;<br \/>\n\t\t\t\t\t\taddChild(img1);<\/p>\n<p>                        pin = 13;<br \/>\n                        arduino = new Arduino(\"127.0.0.1\", 5334);<br \/>\n                        arduino.setPinMode(pin, Arduino.OUTPUT);<br \/>\n\t\t\t\t\t\tarduino.writeDigitalPin(pin, Arduino.LOW);<br \/>\n                }<\/p>\n<p>                public function onTick(event:TimerEvent):void {<br \/>\n                        if ((timerEvent.currentCount % 3) != 0) {<br \/>\n                                arduino.writeDigitalPin(pin, Arduino.HIGH);<br \/>\n                        } else {<br \/>\n                                arduino.writeDigitalPin(pin, Arduino.LOW);<br \/>\n                        }<br \/>\n\t\t\t\t\t\tif (timerEvent.currentCount > 30 ) {<br \/>\n\t\t\t\t\t\t\tarduino.writeDigitalPin(pin, Arduino.LOW);<br \/>\n\t\t\t\t\t\t\ttimerEvent.stop();<br \/>\n\t\t\t\t\t\t}<br \/>\n                }<br \/>\n        }<br \/>\n}<br \/>\n<\/code><\/p>\n<p>\u52d5\u304b\u3057\u65b9\u3002<\/p>\n<p>\uff11.PC\u3067Arduino\u3092\u8d77\u52d5\u3002StandardFirmata\u3092\u9078\u3093\u3067\u8aad\u307f\u8fbc\u3080\uff08\u81ea\u5206\u306e\u5834\u5408\u306fUNO\u3060\u3063\u305f\u306e\u3067UNO\u3092\u8aad\u307f\u8fbc\u3093\u3060\uff09\u3002<br \/>\n\uff12\uff0ePC\u3067Serproxy.exe\u3092\u8d77\u52d5<br \/>\n\uff13\uff0e\u4e0a\u8a18\u306eSWF\u3092\u305f\u305f\u3044\u3066\u8d77\u52d5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Arduino\u3092Flash(swf\uff09\u304b\u3089\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3057\u3066\u307f\u305f\u3002 \u201dFlash\u304b\u3089\u4f7f\u3046\u201d\u304c\u3059\u3054\u304f\u53c2\u8003\u306b\u306a\u3063\u305f \uff11\uff0eFlashDevelop\u3067\u4f5c\u6210\u3059\u308b\u3002 \uff12\uff0e\u4e0a\u8a18\u30b5\u30a4\u30c8\u306b\u3042\u308b\u3088\u3046\u306b\u3001\u30b7\u30ea\u30a2\u30eb\u30dd\u30fc\u30c8\u306e\u307f\u6ce8\u610f\u3057\u3066\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8abf <a class=\"more-link\" href=\"http:\/\/www.u2-life.net\/ss\/blog\/2012\/08\/13\/arduino%e3%82%92swf%e3%81%8b%e3%82%89%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab\/\">\u7d9a\u304d\u3092\u8aad\u3080 <i class=\"fa fa-chevron-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-arduino"],"_links":{"self":[{"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":4,"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":112,"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/posts\/108\/revisions\/112"}],"wp:attachment":[{"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.u2-life.net\/ss\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}