In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Arduino LED Tester

Get Adobe Flash player
by alumican_net 27 May 2011

    Talk

    esimov at 27 May 2011 17:14
    Do you mean, it will be implemented the support for Arduino?
    Embed
/**
 * Copyright alumican_net ( http://wonderfl.net/user/alumican_net )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dfJC
 */

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import funnel.*;
    import funnel.gui.*;
    import funnel.ui.*;
    
    /**
     * Arduino Tester
     * @author Yukiya Okuda<alumican.net>
     */
    [SWF(backgroundColor=0xffffff, frameRate=60)]
    public class ArduinoTester extends Sprite
    {
        private var _arduino:Arduino;
        
        public function ArduinoTester():void
        {
            var config:Configuration = Arduino.FIRMATA;
            config.setDigitalPinMode(10, PWM);
            config.setDigitalPinMode(11, PWM);
            
            _arduino = new Arduino(config);
            
            //Arduino Stats
            var gui:ArduinoGUI = addChild( new ArduinoGUI() ) as ArduinoGUI;
            _arduino.gui = gui;
            
            //Blink 13pin LED : 1000ms interval (i.e. 1Hz)
            //var led:LED = new LED(_arduino.digitalPin(13));
            //led.blink(1000, 0);
            

            var led1:LED = new LED(_arduino.digitalPin(10));
            var led2:LED = new LED(_arduino.digitalPin(11));
            //led.blink(1000, 0, Osc.SIN);
            //led.fadeIn();
            //led.intensity = 0.5;
            
            addEventListener(Event.ENTER_FRAME, function(e:Event):void
            {
                led1.intensity = stage.mouseX / stage.stageWidth;
                led2.intensity = stage.mouseY / stage.stageHeight;
                //trace(led.intensity);
            });
        }
    }
}