Arduino LED Tester
/**
* 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);
});
}
}
}