Esempio n. 1
0
        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);
        }
        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());
        }