internal AdcChannel(AdcController controller, IAdcControllerProvider provider, int channelNumber)
        {
            m_controller = controller;
            m_provider = provider;
            m_channelNumber = channelNumber;

            m_provider.AcquireChannel(channelNumber);
        }
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         m_provider.ReleaseChannel(m_channelNumber);
         m_controller = null;
         m_provider = null;
     }
 }
        public MainPage()
        {
            this.InitializeComponent();

            // Create a new SpeechSynthesizer instance for later use.
            synthesizer = new SpeechSynthesizer();

            // Initialize the ADC chip for use
            adcController = (await AdcController.GetControllersAsync(AdcMcp3008Provider.GetAdcProvider()))[0];
            LowPotAdcChannel = adcController.OpenChannel(LowPotentiometerADCChannel);
            HighPotAdcChannel = adcController.OpenChannel(HighPotentiometerADCChannel);
            CdsAdcChannel = adcController.OpenChannel(CDSADCChannel);
        }
        public static AdcController[] GetControllers(IAdcProvider provider)
        {
            // FUTURE: This should return "Task<IVectorView<AdcController>>"

            var providers = provider.GetControllers();
            var controllers = new AdcController[providers.Length];

            for (int i = 0; i < providers.Length; ++i)
            {
                controllers[i] = new AdcController(providers[i]);
            }

            return controllers;
        }
        protected async void Initialise(string yourName = "Maker", CloudMode cloudMode = CloudMode.None)
        {
            Util.SetName(yourName);
            SensorMgr.DeviceName = Util.GetHostName();

            StartNetworkServices(cloudMode);

            InitialiseHatAsync(false, true, false).Wait();

            // for now not using the adc on the explorer hat as it's set to 3.3volts
            adcManager.Providers.Add(new ADS1015(Glovebox.IoT.Devices.Converters.ADS1015.Gain.Volt5));
            ADS1015 = (await adcManager.GetControllersAsync())[0];

            ShortLedShow();

            light = new LightSensor(ADS1015.OpenChannel((int)Pin.Analog.A3));
            temp = new TempSensor(ADS1015.OpenChannel((int)Pin.Analog.A4), 5000); //version one of wiring on Explorer Pro for ADC = 5v - this will change to 3.3v in the future 
            mem = new MemSensor();

            matrix = new LED8x8Matrix(new Ht16K33());
        }
Exemple #6
0
 internal AdcChannel(AdcController controller, int channelNumber)
 {
     _adcController = controller;
     _channelNumber = channelNumber;
 }
        public async Task InitaliseAdcAsync() {
            adcManager = new AdcProviderManager();
            adcManager.Providers.Add(new ADS1015(gain));
            adcControllers = await adcManager.GetControllersAsync();

            Adc = adcControllers[0];

            IsAdcInitalised = true;
        }