POV test
/**
* Copyright azuremous ( http://wonderfl.net/user/azuremous )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/iOIk
*/
package {
import flash.display.Sprite;
import funnel.*;
import funnel.ui.*;
import flash.events.Event;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class FlashTest extends Sprite {
private var arduino:Arduino;
private var timer:Timer;
private var resetTimer:Timer;
public function FlashTest() {
var config:Configuration = Arduino.FIRMATA;
config.setDigitalPinMode(6, DIN);
arduino = new Arduino(config);
led();
}
private function led():void{
var led1:LED =new LED(arduino.digitalPin(13));
var led2:LED =new LED(arduino.digitalPin(12));
var led3:LED =new LED(arduino.digitalPin(11));
var led4:LED =new LED(arduino.digitalPin(10));
var button:Pin = arduino.digitalPin(6);
button.addEventListener(PinEvent.RISING_EDGE,
function(e:Event):void {
timer = new Timer(1000, 0);
timer.start();
timer.addEventListener(TimerEvent.TIMER, function onTimer(e:TimerEvent):void {
led1.value = 0.0;
led2.value = 0.0;
led3.value = 0.0;
led4.value = 0.0;
});
});
button.addEventListener(PinEvent.FALLING_EDGE,
function(e:Event):void {
timer = new Timer(1000, 0);
timer.start();
timer.addEventListener(TimerEvent.TIMER, function onTimer(e:TimerEvent):void {
led1.value = 1.0;
led2.value = 1.0;
led3.value = 1.0;
led4.value = 1.0;
});
});
}
}
}