/// <summary> /// Rotazione oraria apre la persiana paralume. Rotazione anti-oraria chiude la persiana paralume /// </summary> /// <param name="portaA1"></param> /// <param name="portaA2"></param> /// <param name="portaB1"></param> /// <param name="portaB2"></param> /// <param name="portaEndStopOrario"></param> /// <param name="portaEndStopAntiOrario"></param> /// <param name="portaOnOffLuce"></param> public LightDevice( OutShiftRegister shift, int bitA1, int bitA2, int bitB1, int bitB2, int bitLampada, int portaEndStopOrario, int portaEndStopAntiOrario) : base(shift, bitA1, bitA2, bitB1, bitB2, portaEndStopOrario, portaEndStopAntiOrario) { _shift = shift; _bitLampada = bitLampada; shift[bitLampada] = false; shift.OutBits(); //Conta numero di step fra un fine-corsa e l'altro PosizionaFineCorsaAntiOrario(); //Si posiziona a fine-corsa anti oraria apre completamente la persiana paralume _stepTotali = 0; while (StepOrario(1)) { _stepTotali++; //Conta il numero di step fra i due finecorsa e chiude la persiana paralume } _posizioneAttualeInStep = 0; //Aggiorna la posizione attuale _percentuale = 0; //Aggiorna la percentuale attuale this.InvokeWriteLog("LightDevice " + _percentuale); Folle(); }
public Device_OnOffShift(OutShiftRegister shift, int numBit) { _shift = shift; _numBit = numBit; _shift[numBit] = false; _shift.OutBits(); }
private int _fase; // Numero di fase /// <summary> /// inizializzazione dispositivo /// </summary> /// <param name="portaEndStopOrario">Porta collegata all fine corsa sulla rotazione oraria false quando premuto</param> /// <param name="portaEndStopAntiOrario">Porta collegata all fine corsa sulla rotazione anti-oraria false quando premuto</param> public StepMotorEndStopShift( OutShiftRegister shift, int bitA1, int bitA2, int bitB1, int bitB2, int portaEndStopOrario, int portaEndStopAntiOrario) { _shift = shift; _bitA1 = bitA1; _bitA2 = bitA2; _bitB1 = bitB1; _bitB2 = bitB2; //var gpio = GpioController.GetDefault(); //if (gpio == null) throw new Exception("GPIO Initialization Failed"); _endStopOr = new DigitalIO(portaEndStopOrario, GpioPinDriveMode.InputPullUp); _endStopAn = new DigitalIO(portaEndStopAntiOrario, GpioPinDriveMode.InputPullUp); _fase = 0; Folle(); }
public LCD1602Shift( OutShiftRegister shift, int bit0, int bit1, int bit2, int bit3, int enable, int registerSelect) { _shift = shift; _LCDRegisterSelect = registerSelect; _LCDEnable = enable; _LCDBit0 = bit0; _LCDBit1 = bit1; _LCDBit2 = bit2; _LCDBit3 = bit3; shift[_LCDRegisterSelect] = false; shift.OutBits(); // 4 bit data communication //Task.Delay(50); shift[_LCDBit3] = false; shift[_LCDBit2] = false; shift[_LCDBit1] = true; shift[_LCDBit0] = true; shift.OutBits(); shift[_LCDEnable] = true; //Toggle the Enable Pin shift.OutBits(); shift[_LCDEnable] = false; shift.OutBits(); //Task.Delay(50); shift[_LCDBit3] = false; shift[_LCDBit2] = false; shift[_LCDBit1] = true; shift[_LCDBit0] = true; shift.OutBits(); shift[_LCDEnable] = true; //Toggle the Enable Pin shift.OutBits(); shift[_LCDEnable] = false; shift.OutBits(); //Task.Delay(50); shift[_LCDBit3] = false; shift[_LCDBit2] = false; shift[_LCDBit1] = true; shift[_LCDBit0] = true; shift.OutBits(); shift[_LCDEnable] = true; //Toggle the Enable Pin shift.OutBits(); shift[_LCDEnable] = false; shift.OutBits(); //Task.Delay(50); shift[_LCDBit3] = false; shift[_LCDBit2] = false; shift[_LCDBit1] = true; shift[_LCDBit0] = false; shift.OutBits(); shift[_LCDEnable] = true; //Toggle the Enable Pin shift.OutBits(); shift[_LCDEnable] = false; shift.OutBits(); SendCmd(DISP_ON); SendCmd(CLR_DISP); }