%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nightlight.m - Your team members' names - Date
% Description: 
% Usage: 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Circuit Connections:
% V+ connected to photocell
% GND connected to 50k pot, 1k resistor
% 1+ connected to series connection of photocell/10k resistor
% 1- connected to AGND
% W1 connected to LED
% LED connected in series to 1k resistor
% photocell connected in series to 50k pot resistor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% move to command window
commandwindow;

% clean up
clear all;
close all;

% set up DAQ
DAQ = daq.createSession('digilent');                % create DAQ session
DAQ.addAnalogInputChannel('ad1',1,'Voltage');       % add input voltage channel to measure voltage
DAQ.addAnalogOutputChannel('ad1',1,'Voltage');      % add output voltage channel to control LED brightness
DAQ.setPowerSupply('positive','on');                % turn on positive power supply

% indicates the DAQ has been configured and the nightlight process begun
fprintf('Nightlight started...\n');                 % indicates that the nightlight process has started
fprintf('Disconnect pin 1+ to terminate\n');        % instructs how to terminate process

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% begin nightlight process

% INSERT CODE HERE FOR NIGHTLIGHT PROCESS

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% turn off LED and power supply
DAQ.outputSingleScan(0);
DAQ.setPowerSupply('positive','off');