public Form1() { InitializeComponent(); int iIdx; m_bStart = false; // the action stops at the beginning m_szIP = "172.18.3.200"; // modbus slave IP address m_iPort = 502; // modbus TCP port is 502 adamModbus = new AdamSocket(); adamModbus.SetTimeout(1000, 1000, 1000); // set timeout for TCP m_Adam6000Type = Adam6000Type.Adam6024; // the sample is for ADAM-6050 // modbus current list view item m_iAiTotal = AnalogInput.GetChannelTotal(m_Adam6000Type); m_iDiTotal = DigitalInput.GetChannelTotal(m_Adam6000Type); m_iAoTotal = AnalogOutput.GetChannelTotal(m_Adam6000Type); m_iDoTotal = DigitalOutput.GetChannelTotal(m_Adam6000Type); m_bChEnabled = new bool[m_iAiTotal]; m_byAiRange = new byte[m_iAiTotal]; m_byAoRange = new byte[m_iAoTotal]; for (iIdx = 0; iIdx < m_iAoTotal; iIdx++) { // cbxAOChannel.Items.Add(iIdx.ToString()); // } cbxAOChannel.SelectedIndex = -1; txtModule.Text = m_Adam6000Type.ToString(); }
string GetCommand(DigitalInput p7, DigitalInput p8, DigitalInput p9) { bool b7 = p7.Read(); bool b8 = p8.Read(); bool b9 = p9.Read(); if (b7 == false && b8 == false && b9 == true) { //Mainboard.TurnOnLed(15); return("GO"); } else if (b7 == false && b8 == true && b9 == false) { //Mainboard.TurnOnLed(14); return("BACK"); } else if (b7 == false && b8 == true && b9 == true) { //Mainboard.TurnOnLed(13); return("LEFT"); } else if (b7 == true && b8 == false && b9 == false) { //Mainboard.TurnOnLed(12); return("RIGHT"); } else { //Mainboard.TurnOnLed(11); return("STOP"); } }
public DioCrossConnectFixture(int input, int output) { Assert.AreNotEqual(input, output); m_input = new DigitalInput(input); m_output = new DigitalOutput(output); m_allocated = true; }
public void TestAsyncReturnValue() { using (DigitalInput d = NewInput()) { int count = 0; object obj = null; Action <uint, object> mockDelegate = (m, o) => { count++; obj = o; }; SimData.DIO[0].SetValue(false); d.RequestInterrupts(mockDelegate, this); d.EnableInterrupts(); SimData.DIO[0].SetValue(true); Thread.Sleep(50); Assert.AreEqual(1, count); Assert.AreSame(this, obj); } }
public FireAlarmMonitor(int port, int maxConnections, DigitalInput digitalInput) { _ioPort = digitalInput; digitalInput.StateChange += DigitalInputOnStateChange; _socket = new FireAlarmServerSocket(port, maxConnections); _socket.ClientConnected += SocketOnClientConnected; }
void DMPSIOS_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args) { var ioNumber = Int32.Parse(digitalInput.DeviceName.Substring(digitalInput.DeviceName.Length - 1, 1)); CrestronConsole.PrintLine("DMPSIO DigitalStateChange IO is:{0} , and the status is {1}", digitalInput.DeviceName, digitalInput.State); IOChangeEvent(ioNumber, digitalInput.State); }
public TestScene2(IEnumerable <string> args) { candyLight = new StrobeColorDimmer("Candy Light"); candyLight2 = new StrobeColorDimmer("Candy Light 2"); pressureMat = new DigitalInput("Pressure Mat"); pulsatingEffect = new Effect.Pulsating(S(2), 0, 1.0, false); }
public void TestCreateLimits() { List <DigitalInput> inputs = new List <DigitalInput>(); for (int i = 0; i < NumInterrupts; i++) { inputs.Add(new DigitalInput(i)); } foreach (var input in inputs) { input.RequestInterrupts(); } DigitalInput in9 = new DigitalInput(NumInterrupts); Assert.Throws <AllocationException>(() => { in9.RequestInterrupts(); }); in9.Dispose(); foreach (var input in inputs) { input.Dispose(); } }
void EsentialsRoomEmergencyContactClosure_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args) { if (args.State && TriggerOnClose || !args.State && !TriggerOnClose) { RunEmergencyBehavior(); } }
public Form1() { InitializeComponent(); m_b5000 = true; // set to true for module on ADAM-5000; set to false for module on ADAM-5000/TCP if (m_b5000) { m_iCom = 2; // using COM2 adamCom = new AdamCom(m_iCom); adamCom.Checksum = false; // disbale checksum } else { m_szIP = "172.19.1.234"; adamSocket = new AdamSocket(); adamSocket.SetTimeout(1000, 1000, 1000); // set timeout } m_iAddr = 1; // the slave address is 1 m_iSlot = 1; // the slot index of the module m_iCount = 0; // the counting start from 0 m_bStart = false; //m_Adam5000Type = Adam5000Type.Adam5050; // the sample is for ADAM-5050 m_Adam5000Type = Adam5000Type.Adam5051; // the sample is for ADAM-5051 //m_Adam5000Type = Adam5000Type.Adam5052; // the sample is for ADAM-5052 //m_Adam5000Type = Adam5000Type.Adam5055; // the sample is for ADAM-5055 //m_Adam5000Type = Adam5000Type.Adam5056; // the sample is for ADAM-5056 //m_Adam5000Type = Adam5000Type.Adam5060; // the sample is for ADAM-5060 //m_Adam5000Type = Adam5000Type.Adam5068; // the sample is for ADAM-5068 //m_Adam5000Type = Adam5000Type.Adam5069; // the sample is for ADAM-5069 m_iChTotal = DigitalInput.GetChannelTotal(m_Adam5000Type) + DigitalOutput.GetChannelTotal(m_Adam5000Type); txtModule.Text = m_Adam5000Type.ToString(); }
public HalloweenScene2013(IEnumerable <string> args) { buttonTestHand = new DigitalInput("Hand"); buttonTestHead = new DigitalInput("Head"); buttonTestDrawer1 = new DigitalInput("Drawer 1"); buttonTestDrawer2 = new DigitalInput("Drawer 2"); buttonRunSequence = new DigitalInput("Run Seq!"); buttonTestSound = new DigitalInput("Test Sound"); buttonTestPopEyes = new DigitalInput("Pop Eyes"); buttonTestPopUp = new DigitalInput("Pop Up"); switchHand = new Switch("Hand"); switchHead = new Switch("Head"); switchDrawer1 = new Switch("Drawer 1"); switchDrawer2 = new Switch("Drawer 2"); switchPopEyes = new Switch("Pop Eyes"); switchPopUp = new Switch("Pop Up"); audioPlayer = new AudioPlayer("Audio Player"); raspberry.DigitalInputs[0].Connect(buttonTestHand); raspberry.DigitalInputs[1].Connect(buttonTestHead); raspberry.DigitalInputs[2].Connect(buttonTestDrawer1); raspberry.DigitalInputs[3].Connect(buttonTestDrawer2); raspberry.DigitalInputs[7].Connect(buttonRunSequence); raspberry.DigitalOutputs[7].Connect(switchHand); raspberry.DigitalOutputs[2].Connect(switchHead); raspberry.DigitalOutputs[5].Connect(switchDrawer1); raspberry.DigitalOutputs[6].Connect(switchDrawer2); raspberry.DigitalOutputs[3].Connect(switchPopEyes); raspberry.DigitalOutputs[4].Connect(switchPopUp); raspberry.Connect(audioPlayer); }
public HalloweenScene1(IEnumerable<string> args) { hours = new OperatingHours("Hours"); georgeStrobeLight = new StrobeDimmer("George Strobe"); spiderLight = new StrobeColorDimmer("Spider Light"); skullsLight = new Dimmer("Skulls"); cobWebLight = new Dimmer("Cob Web"); blinkyEyesLight = new Switch("Blinky Eyes"); rgbLightRight = new StrobeColorDimmer("Light Right"); georgeLight = new StrobeColorDimmer("George Light"); leftSkeletonLight = new StrobeColorDimmer("Skeleton Light"); georgeMotor = new MotorWithFeedback("George Motor"); candyLight = new StrobeColorDimmer("Candy Light"); spiderLift = new Switch("Slider Lift"); smokeMachine = new Switch("Smoke Machine"); spiderEyes = new Switch("Spider Eyes"); pressureMat = new DigitalInput("Pressure Mat"); testButton = new DigitalInput("Test"); pulsatingEffect1 = new Effect.Pulsating("Pulse FX 1", S(2), 0.1, 0.4); pulsatingEffect2 = new Effect.Pulsating("Pulse FX 2", S(2), 0.3, 0.5); candyPulse = new Effect.Pulsating("Candy Pulse", S(3), 0.01, 0.1); flickerEffect = new Effect.Flicker("Flicker", 0.4, 0.6); audioPlayer = new Physical.NetworkAudioPlayer( Properties.Settings.Default.NetworkAudioPlayerIP, Properties.Settings.Default.NetworkAudioPlayerPort); }
public HalloweenScene2013(IEnumerable<string> args) { buttonTestHand = new DigitalInput("Hand"); buttonTestHead = new DigitalInput("Head"); buttonTestDrawer1 = new DigitalInput("Drawer 1"); buttonTestDrawer2 = new DigitalInput("Drawer 2"); buttonRunSequence = new DigitalInput("Run Seq!"); buttonTestSound = new DigitalInput("Test Sound"); buttonTestPopEyes = new DigitalInput("Pop Eyes"); buttonTestPopUp = new DigitalInput("Pop Up"); switchHand = new Switch("Hand"); switchHead = new Switch("Head"); switchDrawer1 = new Switch("Drawer 1"); switchDrawer2 = new Switch("Drawer 2"); switchPopEyes = new Switch("Pop Eyes"); switchPopUp = new Switch("Pop Up"); audioPlayer = new AudioPlayer("Audio Player"); raspberry.DigitalInputs[0].Connect(buttonTestHand); raspberry.DigitalInputs[1].Connect(buttonTestHead); raspberry.DigitalInputs[2].Connect(buttonTestDrawer1); raspberry.DigitalInputs[3].Connect(buttonTestDrawer2); raspberry.DigitalInputs[7].Connect(buttonRunSequence); raspberry.DigitalOutputs[7].Connect(switchHand); raspberry.DigitalOutputs[2].Connect(switchHead); raspberry.DigitalOutputs[5].Connect(switchDrawer1); raspberry.DigitalOutputs[6].Connect(switchDrawer2); raspberry.DigitalOutputs[3].Connect(switchPopEyes); raspberry.DigitalOutputs[4].Connect(switchPopUp); raspberry.Connect(audioPlayer); }
void digitalInput_Attach(object sender, Phidget22.Events.AttachEventArgs e) { DigitalInput attachedDevice = ((DigitalInput)sender); int deviceSerial = attachedDevice.DeviceSerialNumber; Debug.Log("Attached device " + attachedDevice.DeviceSerialNumber); }
public static void SetUpBeforeClass() { compressor = new Compressor(); fakePressureSwitch = new DigitalOutput(11); fakeCompressor = new AnalogInput(1); fakeSolenoid1 = new DigitalInput(12); fakeSolenoid2 = new DigitalInput(13); if (RobotBase.IsSimulation) { /* * pressureSwitchCallback = (s, o) => * { * var comp = SimData.GetPCM(0).Compressor; * comp.PressureSwitch = o; * comp.On = o; * double voltage = o ? CompressorOffVoltage : CompressorOnVoltage; * SimData.AnalogIn[1].Voltage = voltage; * }; */ pressureSwitchCallback = (string name, HAL_Value value) => { SimData.PCM[0].SetPressureSwitch(value.GetBoolean()); SimData.PCM[0].SetCompressorOn(value.GetBoolean()); double voltage = value.GetBoolean() ? CompressorOffVoltage : CompressorOnVoltage; SimData.AnalogIn[1].SetVoltage(voltage); }; callbackId = SimData.DIO[11].RegisterValueCallback(pressureSwitchCallback, false); } }
public TestScene2(IEnumerable<string> args) { candyLight = new StrobeColorDimmer("Candy Light"); candyLight2 = new StrobeColorDimmer("Candy Light 2"); pressureMat = new DigitalInput("Pressure Mat"); pulsatingEffect = new Effect.Pulsating("Pulse FX", S(2), 0, 1.0, false); }
public void DigitalInputPressed(DigitalInput buttonIn) { switch (buttonIn) { case DigitalInput.Up: UpPressed(); break; case DigitalInput.Down: DownPressed(); break; case DigitalInput.Left: LeftPressed(); break; case DigitalInput.Right: RightPressed(); break; case DigitalInput.Select: SelectPressed(); break; } }
void Start() { buttonValue = GameObject.Find("ClickButton2").GetComponent("DigitalInput") as DigitalInput; buttonValue2 = GameObject.Find("ClickButton").GetComponent("DigitalInput") as DigitalInput; fireCheckImage = GameObject.Find("fireExCheck").GetComponent("objectUsing") as objectUsing; collObjValue = GameObject.Find("fire extinguisher").GetComponent("fireCheck") as fireCheck; theWindow = GetComponent <AudioSource>(); windowObj1 = GameObject.Find("WindowUp1"); windowObj2 = GameObject.Find("WindowUp3"); windowObj3 = GameObject.Find("WindowUp5"); windowObj4 = GameObject.Find("WindowUp7"); windowObj5 = GameObject.Find("WindowUp9"); windowObj6 = GameObject.Find("WindowUp11"); windowObj7 = GameObject.Find("WindowUp13"); windowObj8 = GameObject.Find("WindowUp15"); windowObjCheck1 = GameObject.Find("WindowUp1").GetComponent("windowWork") as windowWork; windowObjCheck2 = GameObject.Find("WindowUp3").GetComponent("windowWork") as windowWork; windowObjCheck3 = GameObject.Find("WindowUp5").GetComponent("windowWork") as windowWork; windowObjCheck4 = GameObject.Find("WindowUp7").GetComponent("windowWork") as windowWork; windowObjCheck5 = GameObject.Find("WindowUp9").GetComponent("windowWork") as windowWork; windowObjCheck6 = GameObject.Find("WindowUp11").GetComponent("windowWork") as windowWork; windowObjCheck7 = GameObject.Find("WindowUp13").GetComponent("windowWork") as windowWork; windowObjCheck8 = GameObject.Find("WindowUp15").GetComponent("windowWork") as windowWork; }
public DioCrossConnectFixture(DigitalInput input, DigitalOutput output) { Assert.NotNull(input); Assert.NotNull(output); m_input = input; m_output = output; m_allocated = false; }
public void displayDigitalInputData(DigitalInput tag) { displayBasicTagData(tag); tagScanTimeTextBox.Text = tag.ScanTime.ToString(); tagScanComboBox.Text = tag.Scan.ToString(); tagReadDataTypeComboBox.Text = tag.Read.ToString(); }
public static void DisposeAll() { AnalogInput.DisposeActive(); DigitalInput.DisposeActive(); DigitalInterrupt.DisposeActive(); DigitalOutput.DisposeActive(); PwmOutput.DisposeActive(); }
public Nutcracker3Scene(IEnumerable <string> args) { candyLight = new StrobeColorDimmer("Candy Light"); testButton = new DigitalInput("Test"); allPixels1 = new VirtualPixel1D(256); allPixels2 = new VirtualPixel1D(256); allPixels1.SetAll(Color.White, 0); allPixels2.SetAll(Color.White, 0); var lorImport = new Import.LorImport(@"C:\Users\HLindestaf\Downloads\coke_song\Coke-Cola Christmas.lms"); var channelNames = lorImport.GetChannels.Select(x => lorImport.GetChannelName(x)).ToList(); channelNames.ForEach(x => Console.WriteLine(x)); int pixelPosition = 0; var circuits = lorImport.GetChannels.GetEnumerator(); while (true) { // Controller.IChannelIdentity channelR, channelG, channelB; Controller.IChannelIdentity channel; if (!circuits.MoveNext()) { break; } channel = circuits.Current; VirtualPixel1D pixel1d; int pixelNum; if (pixelPosition < 256) { pixel1d = allPixels1; pixelNum = pixelPosition; } else { pixel1d = allPixels2; pixelNum = pixelPosition - 256; } var pixel = lorImport.MapDevice( channel, name => new SinglePixel(name, pixel1d, pixelNum)); log.Debug("Mapping channel [{0}] to pixel {1} [{2}]", channel, pixelPosition, pixel.Name); pixelPosition++; } lorTimeline = lorImport.CreateTimeline(1); }
public GenericDigitalInputDevice(string key, DigitalInput inputPort) : base(key) { InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc); InputPort = inputPort; InputPort.StateChange += new DigitalInputEventHandler(InputPort_StateChange); }
public TestMidi1(IEnumerable<string> args) { buttonTest1 = new DigitalInput("Test 1"); testLight1 = new ColorDimmer("Test 1"); testInput1 = new AnalogInput("Test 1"); inputH = new AnalogInput("Hue", true); inputS = new AnalogInput("Saturation", true); inputV = new AnalogInput("Value", true); }
void Start() { fireSource = GetComponent <AudioSource>(); buttonValue = GameObject.Find("ClickButton").GetComponent("DigitalInput") as DigitalInput; buttonValue1 = GameObject.Find("ClickButton2").GetComponent("DigitalInput") as DigitalInput; fireUsing = GameObject.Find("fireExCheck").GetComponent("objectUsing") as objectUsing; fireCheckValue = GameObject.Find("Main Camera").GetComponent("sigleButton") as sigleButton; }
public void Initialize(Adam4000Type type, int port, int address = 1, bool checksum = false) { this.AdamType = type; this.SerialPortNumber = port; this.address = address; this.Checksum = checksum; this.DiNumber = DigitalInput.GetChannelTotal(type); this.DoNumber = DigitalOutput.GetChannelTotal(type); }
// Start is called before the first frame update void Start() { playerBody.GetComponent <Rigidbody2D>(); controller = GameObject.FindGameObjectWithTag("Ardunity").GetComponent <ArdunityApp>(); controllerX = GameObject.FindGameObjectWithTag("PlayerX").GetComponent <AnalogInput>(); controllerButton = GameObject.FindGameObjectWithTag("PlayerButton").GetComponent <DigitalInput>(); canJump = true; }
public PixelScene1(IEnumerable<string> args) { testSeq = new Controller.Sequence("Pulse"); candyCane = new Controller.Sequence("Candy Cane"); laserSeq = new Controller.Sequence("Laser"); allPixels = new VirtualPixel1D("All Pixels", 150); buttonTest = new DigitalInput("Test"); }
private void Start() { blueToothe = false; joystick_x = GameObject.Find("HorizontalAxis").GetComponent("AnalogInput") as AnalogInput; joystick_y = GameObject.Find("VerticalAxis").GetComponent("AnalogInput") as AnalogInput; btn1 = GameObject.Find("Button1").GetComponent("DigitalInput") as DigitalInput; btn2 = GameObject.Find("Button2").GetComponent("DigitalInput") as DigitalInput; rigidbody3D = GetComponent <Rigidbody>(); }
public void TestSynchronousTimeout() { using (DigitalInput d = NewInput()) { d.RequestInterrupts(); var retVal = d.WaitForInterrupt(0.5); Assert.AreEqual(WaitResult.Timeout, retVal); } }
public B10001GroupBoard(NeuronGroup neuronGroup, IBoardInformation boardSystemInformation, NeuronSpiConnector spiConnector, I2CConnector i2CConnector, DriverLogger logger) : base(neuronGroup, boardSystemInformation, spiConnector, i2CConnector, logger) { #region Digital Inputs for (ushort i = 0; i < AnzahlDigitalInputs; i++) { var input = new DigitalInput(i + 1, neuronGroup, 0, i); SetObservation(0, input); DigitalInputDictionary.Add(input.UniqueIdentifyer, input); } #endregion Digital Inputs #region Digital Outputs for (ushort i = 0; i < AnzahlDigitalOutputs; i++) { var digitalOutput = new DigitalOutput(1 + i, neuronGroup, i, spiConnector, logger, DigitalRelayOutputType.DigitalOutput, 1, i); DigitalOutputsDictionary.Add(digitalOutput.UniqueIdentifyer, digitalOutput); } #endregion Digital Outputs #region One Wire var oneWireConnector = new OneWireConnector(neuronGroup, 1, Logger, I2CConnector); OneWireConnectorsDictionary.Add(oneWireConnector.UniqueIdentifyer, oneWireConnector); #endregion One Wire #region User LED's for (ushort i = 0; i < UserLedsCount; i++) { var userLed = new UserLed(i + 1, neuronGroup, (ushort)(8 + i), spiConnector, 20, i); UserLedsDictionary.Add(userLed.UniqueIdentifyer, userLed); } #endregion User LED's #region Analog Output var analogOutput = new AnalogOutput(neuronGroup, 1, 2, spiConnector, logger); AnalogOutputsDictionary.Add(analogOutput.UniqueIdentifyer, analogOutput); #endregion Analog Output #region Analog Input var analogInput = new AnalogInput(neuronGroup, 1, 3, spiConnector); SetObservation(3, analogInput); AnalogInputsDictionary.Add(analogInput.UniqueIdentifyer, analogInput); #endregion Analog Input }
public Nutcracker3Scene(IEnumerable<string> args) { candyLight = new StrobeColorDimmer("Candy Light"); testButton = new DigitalInput("Test"); allPixels1 = new VirtualPixel1D(256); allPixels2 = new VirtualPixel1D(256); allPixels1.SetAll(Color.White, 0); allPixels2.SetAll(Color.White, 0); var lorImport = new Import.LorImport(@"C:\Users\HLindestaf\Downloads\coke_song\Coke-Cola Christmas.lms"); var channelNames = lorImport.GetChannels.Select(x => lorImport.GetChannelName(x)).ToList(); channelNames.ForEach(x => Console.WriteLine(x)); int pixelPosition = 0; var circuits = lorImport.GetChannels.GetEnumerator(); while (true) { // Controller.IChannelIdentity channelR, channelG, channelB; Controller.IChannelIdentity channel; if (!circuits.MoveNext()) break; channel = circuits.Current; VirtualPixel1D pixel1d; int pixelNum; if (pixelPosition < 256) { pixel1d = allPixels1; pixelNum = pixelPosition; } else { pixel1d = allPixels2; pixelNum = pixelPosition - 256; } var pixel = lorImport.MapDevice( channel, name => new SinglePixel(name, pixel1d, pixelNum)); log.Debug("Mapping channel [{0}] to pixel {1} [{2}]", channel, pixelPosition, pixel.Name); pixelPosition++; } lorTimeline = lorImport.CreateTimeline(1); }
public GarageEventArgs(DigitalInput input) { if (input.State) { Status = (input.DeviceName.ToString().Equals("Port-01")) ? State.closed : State.open; } else { Status = (input.DeviceName.ToString().Equals("Port-02")) ? State.closing : State.opening; } }
public Nutcracker1Scene(IEnumerable <string> args) { testButton = new DigitalInput("Test"); allPixels = new VirtualPixel1D(60); allPixels.SetAll(Color.White, 0); var lorImport = new Import.LorImport(@"..\..\..\Test Files\HAUK~HALLOWEEN1.lms"); int pixelPosition = 0; var circuits = lorImport.GetChannels.GetEnumerator(); while (true) { Controller.IChannelIdentity channelR, channelG, channelB; if (!circuits.MoveNext()) { break; } channelR = circuits.Current; if (!circuits.MoveNext()) { break; } channelG = circuits.Current; if (!circuits.MoveNext()) { break; } channelB = circuits.Current; var pixel = lorImport.MapDevice( channelR, channelG, channelB, name => new SinglePixel(name, allPixels, pixelPosition)); log.Debug("Mapping channel R[{0}]/G[{1}]/B[{2}] to pixel {3} [{4}]", channelR, channelG, channelB, pixelPosition, pixel.Name); pixelPosition++; } lorTimeline = lorImport.CreateTimeline(null); }
public XmasScene1(IEnumerable<string> args, System.Collections.Specialized.NameValueCollection settings) { testPixels = new Pixel1D("G35", 50); explosion1 = new Dimmer("Explosion 1"); explosion2 = new Dimmer("Explosion 2"); explosion3 = new Dimmer("Explosion 3"); explosion4 = new Dimmer("Explosion 4"); testButton = new DigitalInput("Test"); audioPlayer = new Physical.NetworkAudioPlayer( settings["NetworkAudioPlayerIP"], int.Parse(settings["NetworkAudioPlayerPort"])); }
private void Initialize() { lock (this) { if (!initialized) { relay = GiveRelay(); inputOne = GiveInputOne(); inputTwo = GiveInputTwo(); initialized = true; } } }
public XmasScene1(IEnumerable <string> args, System.Collections.Specialized.NameValueCollection settings) { testPixels = new Pixel1D("G35", 50); explosion1 = new Dimmer("Explosion 1"); explosion2 = new Dimmer("Explosion 2"); explosion3 = new Dimmer("Explosion 3"); explosion4 = new Dimmer("Explosion 4"); testButton = new DigitalInput("Test"); audioPlayer = new Physical.NetworkAudioPlayer( settings["NetworkAudioPlayerIP"], int.Parse(settings["NetworkAudioPlayerPort"])); }
public bool Add(DigitalInput device) { try { context.Devices.Add(device); context.SaveChanges(); return(true); } catch { return(false); } }
public XmasScene1(IEnumerable<string> args) { testPixels = new Pixel1D("G35", 50); explosion1 = new Dimmer("Explosion 1"); explosion2 = new Dimmer("Explosion 2"); explosion3 = new Dimmer("Explosion 3"); explosion4 = new Dimmer("Explosion 4"); testButton = new DigitalInput("Test"); audioPlayer = new Physical.NetworkAudioPlayer( Properties.Settings.Default.NetworkAudioPlayerIP, Properties.Settings.Default.NetworkAudioPlayerPort); }
public DemoScene1(IEnumerable<string> args) { pulsatingEffect1 = new Effect.Pulsating("Pulse FX 1", S(2), 0.1, 1.0, false); light1 = new StrobeColorDimmer("Small RGB"); buttonTestSound = new DigitalInput("Test sound"); buttonPlayBackground = new DigitalInput("Play Background"); buttonPauseBackground = new DigitalInput("Pause Background"); buttonTrigger1 = new DigitalInput("Test seq"); buttonTestLight1 = new DigitalInput("Test light"); buttonTestLight2 = new DigitalInput("Test pulse"); switchTest1 = new Switch("Switch test 1"); audioPlayer = new AudioPlayer("Audio Player"); }
public IceBucket(IEnumerable<string> args) { stateMachine = new Controller.EnumStateMachine<States>("Main"); pulsatingEffect1 = new Effect.Pulsating(S(2), 0.05, 1.0, false); lightSpot = new StrobeColorDimmer("Spotlight"); inputArm = new DigitalInput("Arm"); inputDisarm = new DigitalInput("Disarm"); inputDump = new DigitalInput("Dump"); inputNextSong = new DigitalInput("Next Song"); inputReset = new DigitalInput("Reset"); relayStart = new Switch("Relay Start"); relayDirA = new Switch("Relay Dir A"); relayDirB = new Switch("Relay Dir B"); audioPlayer = new AudioPlayer("Audio Player"); this.oscServer = new Expander.OscServer(9999); stateMachine.For(States.Armed) .SetUp(() => { pulsatingEffect1.Start(); audioPlayer.PlayEffect("Nuclear-alarm"); }) .Execute(instance => { while (!instance.IsCancellationRequested) { instance.WaitFor(S(1)); } }) .TearDown(() => { audioPlayer.PauseFX(); pulsatingEffect1.Stop(); }); stateMachine.For(States.Dumped) .Execute(instance => { while (!instance.IsCancellationRequested) { instance.WaitFor(S(1)); } }); ; stateMachine.SetBackgroundState(States.Idle); }
public void TestCreateDispose() { DigitalInput d1 = new DigitalInput(0); DigitalInput d2 = new DigitalInput(1); d1.RequestInterrupts(); Assert.AreEqual(0, (int)d1.InterruptIndex); d1.CancelInterrupts(); d2.RequestInterrupts(); Assert.AreEqual(0, (int)d2.InterruptIndex); d1.Dispose(); d2.Dispose(); }
public TestScene1(IEnumerable<string> args) { georgeStrobeLight = new StrobeDimmer("George Strobe"); spiderLight = new StrobeColorDimmer("Spider Light"); skullsLight = new Dimmer("Skulls"); cobWebLight = new Dimmer("Cob Web"); blinkyEyesLight = new Switch("Blinky Eyes"); rgbLightRight = new StrobeColorDimmer("Light Right"); rgbLight3 = new StrobeColorDimmer("Light 3"); rgbLight4 = new StrobeColorDimmer("Light 4"); georgeMotor = new MotorWithFeedback("George Motor"); spiderLift = new Switch("Spider Lift"); pressureMat = new DigitalInput("Pressure Mat"); pulsatingEffect = new Effect.Pulsating(S(1), 0.2, 0.7); flickerEffect = new Effect.Flicker(0.4, 0.6); }
public Nutcracker1Scene(IEnumerable<string> args) { testButton = new DigitalInput("Test"); allPixels = new VirtualPixel1D(60); allPixels.SetAll(Color.White, 0); var lorImport = new Import.LorImport(@"..\..\..\Test Files\HAUK~HALLOWEEN1.lms"); int pixelPosition = 0; var circuits = lorImport.GetChannels.GetEnumerator(); while (true) { Controller.IChannelIdentity channelR, channelG, channelB; if (!circuits.MoveNext()) break; channelR = circuits.Current; if (!circuits.MoveNext()) break; channelG = circuits.Current; if (!circuits.MoveNext()) break; channelB = circuits.Current; var pixel = lorImport.MapDevice( channelR, channelG, channelB, name => new SinglePixel(name, allPixels, pixelPosition)); log.Debug("Mapping channel R[{0}]/G[{1}]/B[{2}] to pixel {3} [{4}]", channelR, channelG, channelB, pixelPosition, pixel.Name); pixelPosition++; } lorTimeline = lorImport.CreateTimeline(null); }
public PixelScene1(IEnumerable<string> args) { testSeq = new Controller.Sequence("Pulse"); candyCane = new Controller.Sequence("Candy Cane"); laserSeq = new Controller.Sequence("Laser"); allPixels = new VirtualPixel1D(200); buttonTest = new DigitalInput("Test"); // WS2811 acnOutput.Connect(new Physical.PixelRope(allPixels, 0, 200), 51, 1); // acnOutput.Connect(new Physical.PixelRope(allPixels, 50, 100), 5, 1); // acnOutput.Connect(new Physical.PixelRope(allPixels, 150, 50), 4, 151); // GECE // acnOutput.Connect(new Physical.PixelRope(allPixels, 100, 50), 2, 91); }
public TestScene3(IEnumerable<string> args) { buttonPlayFX = new DigitalInput("Play FX"); buttonPauseFX = new DigitalInput("Pause FX"); buttonCueFX = new DigitalInput("Cue FX"); buttonResumeFX = new DigitalInput("Resume FX"); buttonPlayBackground = new DigitalInput("Play Background"); buttonPauseBackground = new DigitalInput("Pause Background"); buttonBackgroundLowVolume = new DigitalInput("Background Low"); buttonBackgroundHighVolume = new DigitalInput("Background High"); buttonBackgroundNext = new DigitalInput("BG next"); buttonTrigger1 = new DigitalInput("Pop!"); switchTest1 = new Switch("Switch test 1"); audioPlayer = new AudioPlayer("Audio Player"); this.oscServer = new Expander.OscServer(9999); }
public void TestGlitchFilterOverCreation() { List<FilterList> inputs = new List<FilterList>(); try { for (int i = 0; i < 3; i++) { DigitalInput input = new DigitalInput(i); DigitalGlitchFilter filter = new DigitalGlitchFilter(); filter.Add(input); FilterList list = new FilterList { input = input, filter = filter, index = i }; inputs.Add(list); Assert.That(SimData.DIO[i].FilterIndex, Is.EqualTo(i)); } Assert.Throws<AllocationException>(() => { DigitalGlitchFilter filter = new DigitalGlitchFilter(); }); } finally { foreach (var filterList in inputs) { filterList.filter.Remove(filterList.input); filterList.filter.Dispose(); filterList.input.Dispose(); Assert.That(SimData.DIO[filterList.index].FilterIndex, Is.EqualTo(-1)); } } }
public HalloweenScene2013(IEnumerable<string> args) { buttonTestHand = new DigitalInput("Hand"); buttonTestHead = new DigitalInput("Head"); buttonTestDrawer1 = new DigitalInput("Drawer 1"); buttonTestDrawer2 = new DigitalInput("Drawer 2"); buttonRunSequence = new DigitalInput("Run Seq!"); buttonTestSound = new DigitalInput("Test Sound"); buttonTestPopEyes = new DigitalInput("Pop Eyes"); buttonTestPopUp = new DigitalInput("Pop Up"); switchHand = new Switch("Hand"); switchHead = new Switch("Head"); switchDrawer1 = new Switch("Drawer 1"); switchDrawer2 = new Switch("Drawer 2"); switchPopEyes = new Switch("Pop Eyes"); switchPopUp = new Switch("Pop Up"); audioPlayer = new AudioPlayer("Audio Player"); }
private void Initialize() { lock (this) { if (!initialized) { initialized = true; aSource = GiveDigitalInputA(); bSource = GiveDigitalInputB(); encoder = new Encoder(aSource, bSource); counters[0] = new Counter(aSource); counters[1] = new Counter(bSource); motor = GiveSpeedController(); } } }
public void TestCreateLimits() { List<DigitalInput> inputs = new List<DigitalInput>(); for (int i = 0; i < NumInterrupts; i++) { inputs.Add(new DigitalInput(i)); } foreach (var input in inputs) { input.RequestInterrupts(); } DigitalInput in9 = new DigitalInput(NumInterrupts); Assert.Throws<AllocationException>(() => in9.RequestInterrupts()); in9.Dispose(); foreach (var input in inputs) { input.Dispose(); } }
public static void SetUpBeforeClass() { compressor = new Compressor(); fakePressureSwitch = new DigitalOutput(11); fakeCompressor = new AnalogInput(1); fakeSolenoid1 = new DigitalInput(12); fakeSolenoid2 = new DigitalInput(13); if (RobotBase.IsSimulation) { pressureSwitchCallback = (s, o) => { var comp = SimData.GetPCM(0).Compressor; comp.PressureSwitch = o; comp.On = o; double voltage = o ? CompressorOffVoltage : CompressorOnVoltage; SimData.AnalogIn[1].Voltage = voltage; }; SimData.DIO[11].Register("Value", pressureSwitchCallback); } }
public void TestCounterSetDownSourceWithExisitingDownSource() { using (Counter ctr = new Counter()) { TestInit(0, 0, 0, false, false, false, false); ctr.SetDownSource(6); TestInit(0, 0, 6, false, false, false, false); Assert.That(SimData.DIO[6].Initialized, Is.True); using (DigitalInput input = new DigitalInput(5)) { ctr.SetDownSource(input); Assert.That(SimData.DIO[6].Initialized, Is.False); Assert.That(SimData.DIO[5].Initialized, Is.True); TestInit(0, 0, 5, false, false, false, false); } Assert.That(SimData.DIO[5].Initialized, Is.False); } }
public Xmas2013scene(IEnumerable<string> args) { hours = new OperatingHours("Hours"); timeline1 = new Controller.Timeline<string>(1); stateMachine = new Controller.EnumStateMachine<States>("Main"); hatLightState = new Controller.IntStateMachine("Hats"); lightJesus = new StrobeColorDimmer("Jesus"); lightStar = new Dimmer("Star"); lightHat1 = new Dimmer("Hat 1"); lightHat2 = new Dimmer("Hat 2"); lightHat3 = new Dimmer("Hat 3"); lightHat4 = new Dimmer("Hat 4"); lightSnow1 = new Dimmer("Snow 1"); lightSnow2 = new Dimmer("Snow 2"); lightStairs1 = new Dimmer("Stair 1"); lightStairs2 = new Dimmer("Stairs 2"); lightGarland1 = new Dimmer("Garland 1"); lightGarland2 = new Dimmer("Garland 2"); lightGarland3 = new Dimmer("Garland 3"); lightGarland4 = new Dimmer("Garland 4"); lightString1 = new Dimmer("String 1"); lightString2 = new Dimmer("String 1"); lightXmasTree = new Dimmer("Xmas Tree"); lightDeerLarge = new Dimmer("Deer Large"); lightDeerSmall = new Dimmer("Deer Small"); lightTreeUp = new StrobeColorDimmer("Tree up"); switchSanta = new Switch("Santa"); switchDeerHuge = new Switch("Deer Huge"); lightTopperSmall = new Dimmer("Topper Small"); lightTopperLarge = new Dimmer("Topper Large"); lightNet1 = new Dimmer("Net 1"); lightNet2 = new Dimmer("Net 2"); lightVader = new StrobeColorDimmer("Vader"); light3wise = new StrobeColorDimmer("3wise"); pulsatingEffect1 = new Effect.Pulsating("Pulse FX 1", S(4), 0.4, 1.0, false); pulsatingStar = new Effect.Pulsating("Pulse Star", S(2), 0.2, 0.4, false); flickerEffect = new Effect.Flicker("Flicker", 0.5, 0.6, false); faderIn = new Effect.Fader("FaderIn", S(2), 0.0, 1.0, false); candyCane = new Controller.Sequence("Candy Cane"); twinkleSeq = new Controller.Sequence("Twinkle"); backgroundLoop = new Controller.Sequence("Background"); music1Seq = new Controller.Sequence("Christmas Canon"); starwarsCane = new Controller.Sequence("Starwars Cane"); fatherSeq = new Controller.Sequence("Father"); offHours1Seq = new Controller.Sequence("Off hours 1"); offHours2Seq = new Controller.Sequence("Off hours 2"); waveformSeq = new Controller.Sequence("Waveform"); allPixels = new VirtualPixel1D("All Pixels", 100); starwarsPixels = new VirtualPixel1D("Star wars", 50); saberPixels = new VirtualPixel1D("Saber", 60); buttonTest = new DigitalInput("Test"); buttonStartInflatables = new DigitalInput("Inflatables"); buttonOverrideHours = new DigitalInput("Override hours", true); buttonBlue = new DigitalInput("Blue"); buttonRed = new DigitalInput("Red"); switchButtonBlue = new Switch("Blue"); switchButtonRed = new Switch("Red"); elJesus = new Switch("Jesus Halo"); audioPlayer = new AudioPlayer("Audio"); popOut1Piano = new Effect.PopOut("Piano", S(0.4)); popOut1Drums = new Effect.PopOut("Drums", S(0.4)); popOut1DrumsFast = new Effect.PopOut("Drums Fast", S(0.3)); popOut1Chord = new Effect.PopOut("Chord", S(0.4)); popOut1Solo = new Effect.PopOut("Solo", S(0.3)); popOut1Solo2 = new Effect.PopOut("Solo 2", S(0.2)); popOut1Choir = new Effect.PopOut("Choir", S(1.0)); popOut1Voice = new Effect.PopOut("Voice", S(1.0)); popOut1Vocal2 = new Effect.PopOut("Vocal 2", S(2.0)); popOut1VocalLong = new Effect.PopOut("Vocal Long", S(5.0)); popOut1End = new Effect.PopOut("End", S(5.0)); this.oscServer = new Expander.OscServer(10000); }
public void TestCounterInit2() { using (DigitalInput di = new DigitalInput(5)) { using (Counter ctr = new Counter(di)) { TestInit(0, 5, 0, true, false, false, false); } } }
public void TestCounterInit4() { using (DigitalInput us = new DigitalInput(3)) { using (DigitalInput ds = new DigitalInput(4)) { using (Counter ctr = new Counter(EncodingType.K1X, us, ds, true)) { TestInit(Mode.ExternalDirection, 3, 4, true, false, true, true); } } } }
public void TestCounterSetUpSource() { using (DigitalInput src = new DigitalInput(3)) { using (Counter ctr = new Counter()) { ctr.SetUpSource(src); TestInit(0, 3, 0, true, false, false, false); } } }
public void TestCounterDigitalUpSourceNull() { using (DigitalInput validSource = new DigitalInput(0)) { Assert.Throws<ArgumentNullException>(() => { Counter cnt = new Counter(EncodingType.K2X, null, validSource, false); }); } }
public bool Teardown() { var type = motor != null ? GetCustomType() : "null"; if (!tornDown) { bool wasNull = false; var pwm = motor as PWM; if (pwm != null && motor != null) { pwm.Dispose(); motor = null; } else if (motor == null) wasNull = true; if (encoder != null) { encoder.Dispose(); encoder = null; } else wasNull = true; if (counters[0] != null) { counters[0].Dispose(); counters[0] = null; } else wasNull = true; if (counters[1] != null) { counters[1].Dispose(); counters[1] = null; } else wasNull = true; if (aSource != null) { aSource.Dispose(); aSource = null; } else wasNull = true; if (bSource != null) { bSource.Dispose(); bSource = null; } else wasNull = true; tornDown = true; if (wasNull) { throw new NullReferenceException("MotorEncoderFixture had null params at teardown"); } } else { throw new SystemException(type + " Motor Encoder torn down multiple times"); } return true; }