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

flash on 2013-8-20

ff
Get Adobe Flash player
by hyunseop 20 Aug 2013
    Embed
/**
 * Copyright hyunseop ( http://wonderfl.net/user/hyunseop )
 * GNU General Public License, v3 ( http://www.gnu.org/licenses/quick-guide-gplv3.html )
 * Downloaded from: http://wonderfl.net/c/sLKF
 */

package {
    import flash.display.Sprite;
    
    import funnel.*;
    import funnel.ui.*;
    
    public class MeasureBrightness extends Sprite{
        private var arduino:Arduino;
        
        private var sensorPin:Pin;
        private var led:LED;
        
        public function MeasureBrightness(){
            var config:Configuration=Arduino.FIRMATA;
            config.setDigitalPinMode(9,PWM);
            arduino = new Arduino(config);
            
            sensorPin=arduino.analogPin(0);
            led=new LED(arduino.digitalPin(9));
            
            sensorPin.addFilter(new Scaler(0,1,1,0));
            sensorPin.addEventListener(PinEvent.CHANGE,onChange);
        }
        
        private function onChange(e:PinEvent):void{
            led.intensity=sensorPin.value;
        }
    }
}