Exemple #1
0
        /// <summary>
        ///
        ///
        /// </summary>
        /// <param name="x">X-Side pin (output)</param>
        /// <param name="y">Y-Side pin (input)</param>
        /// <returns></returns>
        public bool CheckLEDStatus(int i)
        {
            //wait for 1 sec to be sure the voltage on the board has changed
            Task.Delay(1000);

            double averageVoltage = ADConverter.updateCurrentADCVoltage2Average(AVERAGE_TIMES);

            Debug.WriteLine("Average Voltage on In2 is: " + averageVoltage);

            if (averageVoltage < LED_OFF_THRESHOLD)
            {
                return(false);
            }

            return(true);
        }
        private void updateARDVoltage(string device)
        {
            if (!ReceiverConfig.DeviceResistanceMap.ContainsKey(device))
            {
                Debug.Write("Invalid device provided!");
            }

            double resistance = ReceiverConfig.DeviceResistanceMap[device];
            double voltage    = (ADConverter.CurrentDACVoltage1 / (14.00 + resistance)) * resistance;

            Debug.WriteLine("Setting ARD for Device " + device + " to " + voltage.ToString());

            if (!RasPi.isTestMode())
            {
                ADConverter.setDACVoltage2(voltage);
            }
        }