def run(): ADC.setup(0x48) while True: out_file = open('TempOutput.txt', "a+") mean_value = [] for i in range(20): analogVal = ADC.read(0) Vr = 5 * float(analogVal) / 255 Rt = 10000 * Vr / (5 - Vr) temp = 1 / (((math.log(Rt / 10000)) / 3950) + (1 / (273.15 + 25))) temp = temp - 273.15 mean_value.append(temp) print(temp) if len(mean_value) > 20: mean_value.remove(mean_value[0]) sleep(0.1) average_temp = sum(mean_value) / len(mean_value) print(average_temp) out_file.write(str(average_temp) + "\n") if 36.1 <= average_temp <= 37.2: time.sleep(10) # insert name of function that reads data from sensor elif average_temp >= 38: # insert code for app alerts print("High Temperature! Risk of fever! " + "\n" + str(datetime.now())) # insert name of function that reads data from sensor else: # insert code for app alerts print("Low Temperature! Risk of fever! " + "\n" + str(datetime.now())) # insert name of function that reads data from sensor out_file.close()
def loop(): status = 1 while True: print('Value: ', ADC.read(1)) print('Value 2: ', ADC.read(2)) time.sleep(2)
def setup(self): GPIO.setmode(GPIO.BCM) ADC.setup(0x48) LCD.init(0x27, 1) self.display_text("System startup") # setup pins for sensors GPIO.setup(self.THERMISTOR_PIN, GPIO.IN) GPIO.setup(self.GAS_SENSOR_PIN, GPIO.IN) GPIO.setup(self.BUZZ_PIN, GPIO.OUT) GPIO.setup(self.H2O_PIN, GPIO.IN) # setup pins for "eyes" # first eye GPIO.setup(self.SDI_0, GPIO.OUT) GPIO.setup(self.RCLK_0, GPIO.OUT) GPIO.setup(self.SRCLK_0, GPIO.OUT) GPIO.output(self.SDI_0, GPIO.LOW) GPIO.output(self.RCLK_0, GPIO.LOW) GPIO.output(self.SRCLK_0, GPIO.LOW) # second eye GPIO.setup(self.SDI_1, GPIO.OUT) GPIO.setup(self.RCLK_1, GPIO.OUT) GPIO.setup(self.SRCLK_1, GPIO.OUT) GPIO.output(self.SDI_1, GPIO.LOW) GPIO.output(self.RCLK_1, GPIO.LOW) GPIO.output(self.SRCLK_1, GPIO.LOW)
def direction(): """ Returns the joystick status """ state = ['home', 'up', 'down', 'left', 'right', 'pressed'] i = 0 if ADC.read(0) <= 5: i = 1 # up if ADC.read(0) >= 250: i = 2 # down if ADC.read(1) >= 250: i = 3 # left if ADC.read(1) <= 5: i = 4 # right if ADC.read(2) == 0: i = 5 # Button pressed if ADC.read(0) - 125 < 15 and ADC.read(0) - 125 > -15 \ and ADC.read(1) - 125 < 15 and ADC.read(1) - 125 > -15 \ and ADC.read(2) == 255: i = 0 return state[i]
def setup(): ADC.setup(0x48) GPIO.setup(ledPin, GPIO.OUT) GPIO.output(ledPin, GPIO.LOW) global p p = GPIO.PWM(ledPin, 1000) p.start(0)
def setup(Rpin, Gpin, Bpin): global pins global p_R, p_G, p_B ADC.setup(0x48) pins = {'pin_R': Rpin, 'pin_G': Gpin, 'pin_B': Bpin} GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location GPIO.setup(TRIG, GPIO.OUT) GPIO.setup(ECHO, GPIO.IN) for i in pins: GPIO.setup(pins[i], GPIO.OUT) # Set pins' mode is output GPIO.output(pins[i], GPIO.HIGH) # Set pins to high(+3.3V) to off led p_R = GPIO.PWM(pins['pin_R'], 2000) # set Frequece to 2KHz p_G = GPIO.PWM(pins['pin_G'], 1999) p_B = GPIO.PWM(pins['pin_B'], 5000) p_R.start(100) # Initial duty Cycle = 0(leds off) p_G.start(100) p_B.start(100) #setup LCD LCD1602.init(0x27, 1) # init(slave address, background light) LCD1602.write(0, 0, 'Ultrasonic Range:') LCD1602.write(1, 1, '...') print 'Done sensor setup' time.sleep(2) setupMQTT() print 'Done AWS_IOT_MQTT setup' time.sleep(2)
def setup(): ADC.setup(0x48) GPIO.setup(D0, GPIO.IN) LCD1602.init(0x27, 1) # init(slave address, background light) #LCD1602.write(0, 0, 'Andorich') #LCD1602.write(1, 1, 'Sugondese') time.sleep(2)
def setup(): ADC.setup(0x48) GPIO.setup(DO, GPIO.IN) def Print(x): if x == 1: print '' print ' ***************' print ' * Not raining *' print ' ***************' print '' if x == 0: print '' print ' *************' print ' * Raining!! *' print ' *************' print '' def loop(): status = 1 while True: print ADC.read(0) tmp = GPIO.input(DO); if tmp != status: Print(tmp) status = tmp time.sleep(0.2) if __name__ == '__main__': try: setup() loop() except KeyboardInterrupt: pass
def volume_control(threadName): volume_array = [0, 0, 0, 0, 0] prev = 0 while True: if exitFlag: break # To smoothe the data volume_array[0] = map(ADC.read(1), 0, 170, 0, 100) volume_array[1] = map(ADC.read(1), 0, 170, 0, 100) volume_array[2] = map(ADC.read(1), 0, 170, 0, 100) volume_array[3] = map(ADC.read(1), 0, 170, 0, 100) volume_array[4] = map(ADC.read(1), 0, 170, 0, 100) volume = (volume_array[0] + volume_array[1] + volume_array[2] + volume_array[3] + volume_array[4]) / 5 volume = int(volume) # only if the volume change more than 2%, then call amixer if ((volume - prev) > 1) or ((volume - prev) < -1): call(["amixer", "set", "PCM", str(volume) + "%"]) time.sleep(0.1) prev = volume
def loop(): while True: signal = int(ADC.read(0)) * 4 if signal > Treshold: print signal ADC.write(ADC.read(0)) sleep(0.01)
def makerobo_loop(): makerobo_status = 1 # 状态值 # 无限循环 # while True: print('Photoresistor Value: ', ADC.read(0)) # 读取AIN0的值,获取光敏模拟量值 # time.sleep(0.2) # 延时200ms return ADC.read(0)
def setup(): GPIO.setwarnings(False) # don't show warnings if GPIO is in use GPIO.setmode(GPIO.BOARD) # use GPIO by physical location for pin in pins: # iterate throug all pin numbers GPIO.setup(pin, GPIO.OUT) # initialize the LED pin as output GPIO.output(pin, GPIO.HIGH) # turn off LED ADC.setup(0x48)
def setup(): global CURRENT_DAY global CURRENT_MON global CURRENT_HOUR global CROP global SYSTEM_CONTROLLER GPIO.setmode(GPIO.BOARD) GPIO.setup(RAIN_SENSOR_PIN, GPIO.IN) ADC.setup(0x48) global TEMPERATURE_SENSOR for i in os.listdir('/sys/bus/w1/devices'): if i != 'w1-bus-master1': TEMPERATURE_SENSOR = i print('== Program starting ==') GPIO.setup(FAN_PIN, GPIO.OUT) GPIO.setup(ROOF_PIN, GPIO.OUT) GPIO.setup(HEAT_PIN, GPIO.OUT) GPIO.setup(WATER_PIN, GPIO.OUT) GPIO.setup(SHADE_PIN, GPIO.OUT) GPIO.setup(BLACKOUT_PIN, GPIO.OUT) GPIO.setup(LIGHT_PIN, GPIO.OUT) CURRENT_DAY = datetime.datetime.today().day CURRENT_MON = datetime.datetime.today().month CURRENT_HOUR = datetime.datetime.today().hour CROP = Crop('plant.csv') SYSTEM_CONTROLLER = SystemController(SYSTEM_PINS, GPIO) # Starting thread for user input thread.start_new_thread(listen_for_input, ())
def light_sensor_setup(): DO = 17 light_sensor_address = 0x48 GPIO.setmode(GPIO.BCM) ADC.setup(light_sensor_address) GPIO.setup(DO, GPIO.IN)
def loop(): status = 1 while True: print('Value:', ADC.read(0)) Value = ADC.read(0) outvalue = map(Value, 0, 255, 120, 255) ADC.write(outvalue) time.sleep(0.2)
def setup(): ADC.setup(0x48) GPIO.setup(DO, GPIO.IN) GPIO.setup(LEDOUT, GPIO.OUT) GPIO.setup(PUSH_BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_UP) reset_system() initialize_tradlos() initialize_flash_led()
def joydirection(): i = 0 if ADC.read(1) <= 100: i = 1 #left if ADC.read(1) >= 150: i = 2 #right if ADC.read(1) < 138 and ADC.read(1) > 118: i = 0 return i
def get_temperature(): ADC.setup(0x48) analogVal = ADC.read(0) Vr = 5 * float(analogVal) / 255 Rt = 10000 * Vr / (5 - Vr) temp = 1 / (((math.log(Rt / 10000)) / 3950) + (1 / (273.15 + 25))) temp = temp - 273.15 print('temperature = %s C'%temp) return '%.2f'%temp
def check_for_gas(): status = 1 count = 0 print ADC.read(3) tmp = GPIO.input(DO); if tmp != status: Print(tmp) else: Print(0)
def destroy(): ADC.write(0) Rpwm.stop Gpwm.stop Bpwm.stop GPIO.output(Rpin, GPIO.HIGH) GPIO.output(Gpin, GPIO.HIGH) GPIO.output(Bpin, GPIO.HIGH) GPIO.cleanup
def destroy(): ADC.write(0) Rpwm.stop Gpwm.stop Bpwm.stop GPIO.output(Rpin, GPIO.HIGH) GPIO.output(Gpin, GPIO.HIGH) GPIO.output(Bpin, GPIO.HIGH) GPIO.cleanup
def setup(gpioPort, i2cAddress): global initialRainIntensityReading global lowerBoundary GPIO.setmode(GPIO.BCM) ADC.setup(i2cAddress) GPIO.setup(gpioPort, GPIO.IN) initialRainIntensityReading = ADC.read(0) # set the delta zone so we dont need to recalc it every time lowerBoundary = initialRainIntensityReading - rainDelta print "initial rain intensity reading: ", initialRainIntensityReading
def loop(): status = '' while True: tmp = direction() if tmp != None and tmp != status: print(tmp) # z x y print("z x y: ",ADC.read(0), ADC.read(1), ADC.read(2)) status = tmp time.sleep(1)
def loop(): while True: value = ADC.read(0) # read the potentiometer value dc = value / 2.55 # duty cycle goes from 0 to 100, the potentiometer value from 0 to 255 print 'Value: ' + str(value) print 'DC: ' + str(dc) p.ChangeDutyCycle( dc) # set the brightness, changing duty cycle to the value of dc ADC.write(value) time.sleep(0.05) # wait for 50 ms
def setup(gpioPort, i2cAddress): global initialRainIntensityReading global lowerBoundary GPIO.setmode(GPIO.BCM) ADC.setup(i2cAddress) GPIO.setup(gpioPort, GPIO.IN) initialRainIntensityReading = ADC.read(0) # set the delta zone so we dont need to recalc it every time lowerBoundary = initialRainIntensityReading - rainDelta print "initial rain intensity reading: ", initialRainIntensityReading
def setup_board(): #SETUP The board global Buzz #use the global var GPIO.setmode(GPIO.BCM) #Set mode to BCM GPIO.setwarnings(False) # call this function to avoid warnings #Switch 1 Parking GPIO.setup( door_switch, GPIO.OUT ) #Set door_switch as OUTPUT - High tells door to open and low tells door to close #Buzzer Setup GPIO.setup(buzzer_output, GPIO.OUT) Buzz = GPIO.PWM( buzzer_output, 500) # buzzer output is the channel, initial frequency is 500 #ultrasonic setup GPIO.setup(TRIG, GPIO.OUT) GPIO.setup(ECHO, GPIO.IN) #Setup RFID #This pin corresponds to GPIO22, which we'll use to turn the RFID reader on and off with. GPIO.setup(ENABLE_PIN, GPIO.OUT) GPIO.output(ENABLE_PIN, GPIO.LOW) global ser #Set up the serial port as per the Parallex reader's datasheet ser = serial.Serial(baudrate=2400, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, port=SERIAL_PORT, stopbits=serial.STOPBITS_ONE, timeout=1) #IR Detector Interrupt setup GPIO.setup(INTR_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) #interrupt call defintion GPIO.add_event_detect(INTR_PIN, GPIO.RISING, callback=door_bell_pressed, bouncetime=2000) #Keypad Setup According to the default connections GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(23, GPIO.OUT) GPIO.setup(24, GPIO.OUT) GPIO.setup(25, GPIO.OUT) GPIO.setup(26, GPIO.OUT) #initialize LCD LCD.init(0x27, 1) #(slave address, background light) #ADC Initialization ADC.setup(0x48) #Address of the ADC on i2c in hex
def loop(): status = 1 while True: print ADC.read(0) tmp = GPIO.input(DO); if tmp != status: Print(tmp) status = tmp time.sleep(0.2)
def loop(): status = 1 while True: print ADC.read(0) tmp = GPIO.input(DO) if tmp != status: Print(tmp) status = tmp time.sleep(0.2)
def run(): # collect the data temp = get_temperature() # there's some math with this light = ADC.read(LIGHT_PIN) moisture = ADC.read(MOISTURE_PIN) timestamp = time.strftime('%Y-%m-%d %H:%M:%S') # write the data line = ','.join([str(v) for v in [timestamp, temp, light, moisture]]) print line sys.stdout.flush()
def setup(): global p GPIO.setwarnings(False) # don't show warnings if GPIO is in use GPIO.setmode(GPIO.BOARD) # use GPIO by physical location GPIO.setup(ledPin, GPIO.OUT) # initialize the LED pin as output ADC.setup(0x48) p = GPIO.PWM( ledPin, 100) # setup the pin for PWM, 100 Hz is enough not to see a blinking p.start(0) # start the PWM instance with 0 duty cycle
def measure(): ADC.setup(0x48) bus = smbus.SMBus(1) reading = ADC.read(2) voltage = ADC.read(1) #ADC.write(ADC.read(0)) value = ((0.641025641) * reading) moistureLevel = (100 - value) * 2 phValue = gradient * voltage + intercept if moistureLevel > 100: moistureLevel = 100 return moistureLevel, phValue
def setup(): ADC.setup(0x48) LCD.init(0x27, 1) LCD.write(0,0,'System startup...') time.sleep(1) ALARM = False LCD.clear() GPIO.setup(THERMISTOR_PIN, GPIO.IN) GPIO.setup(GAS_SENSOR_PIN, GPIO.IN) GPIO.setup(BUZZ_PIN, GPIO.OUT) GPIO.setup(H2O_PIN, GPIO.OUT) GPIO.output(BUZZ_PIN, GPIO.HIGH)
def loop(): while True: value = ADC.read(0) # read the potentiometer value ms = float(value) / 1000 print 'Milliseconds: ' + str(ms) ADC.write(ms) print "Led ON..." GPIO.output(ledPin, GPIO.LOW) # turn on led time.sleep(ms) # wait for the number of seconds in ms print "Led OFF..." GPIO.output(ledPin, GPIO.HIGH) # turn off led time.sleep(ms) # wait for the number of seconds in ms
def loop(): worker = Thread(target=queue_task, args=(q,)) worker.setDaemon(True) worker.start() alarm_thread = Thread(target=alarm_task) alarm_thread.setDaemon(True) alarm_thread.start() status = 1 count = 0 q_count = 0 now = datetime.now() LCD.write(0,0,'System Normal') while True: # get and convert temperature analogTemp = ADC.read(0) Vr = 5 * float(analogTemp) / 255 Rt = 10000 * Vr / (5 - Vr) temp = 1/(((math.log(Rt / 10000)) / 3950) + (1 / (273.15 + 25))) temp = (temp - 273.15) * 9/5 + 32 print 'temperature = ', temp, 'F' # get and convert gas sensor data gas = ADC.read(1) print 'gas sensor = ', gas # tmp = GPIO.input(GAS_SENSOR) # if tmp != status: # check_gas(tmp) # status = tmp # if status == 0: # count += 1 # if count % 2 == 0: # GPIO.output(BUZZ, 1) # else: # GPIO.output(BUZZ, 0) # else: # GPIO.output(BUZZ, 1) # count = 0 # get water data h2o = ADC.read(2) print "h2o sensor = " + str(h2o) update_LCD(temp, gas, h2o) if q_count > 3.5: updates = [] updates.append({'type' : 'temperature', 'value': str(temp), 'timestamp': str(datetime.now())}) updates.append({'type' : 'gas', 'value': str(ADC.read(1)), 'timestamp': str(datetime.now())}) updates.append({'type' : 'h2o', 'value': str(h2o), 'timestamp': str(datetime.now())}) q.put(updates) q_count = 0 q_count = q_count + 1 time.sleep(2)
def read_PCF8591(channel, analogInput): ADC.setup(channel) value = 0 runs = 5 # read sensor a few times to ensure a good value for x in range(runs): analogVal = ADC.read(analogInput) value += analogVal time.sleep(0.1) # calculate the average of the sensing runs avgValue = value / runs percentage = avgValue / 255 return percentage
def __init__(self): """ pi.init() constructor to initialize class """ self._valid_import = VALID_IMPORT #setup constants self._DO = 17 if(self._valid_import): GPIO.setmode(GPIO.BCM) ADC.setup(0x48) GPIO.setup(self._DO, GPIO.IN) self._humiture = HumitureSensor()
def indexroute(): Temp_units = ADC.read(0) #Read ADC units on chn 0 Temp_volts = ( Temp_units * 3.3 ) / 256 #Convert to voltage based on ADC resolution (vref+-vref-)/2^N temp = Temp_volts / 0.01 # using temperature sensor eqn: 10mV/1C ADC.write(Temp_units) # write to dac to adjust LED brightness Hum_units = ADC.read(1) #Read ADC units on chn 1 Hum_volts = ( Hum_units * 3.3 ) / 256 #Convert to voltage based on ADC resolution (vref+-vref-)/2^N humidity = (Hum_volts - 0.985) / 0.0307 # using humidity sensor eqn return "Welcome! The current temp is %2.2f and the humidity is %2.2f" % ( temp, humidity) #Return the temp and humidty
def loop(): status = 1 tmp = 1 while True: analogVal = ADC.read(0) Vr = 5 * float(analogVal) / 255 Rt = 10000 * Vr / (5 - Vr) temp = 1/(((math.log(Rt / 10000)) / 3950) + (1 / (273.15+25))) temp = temp - 273.15 # temp = temp * 9/5 + 32 print 'temperature = ', temp, 'C' # For a threshold, uncomment one of the code for # which module you use. DONOT UNCOMMENT BOTH! ################################################# # 1. For Analog Temperature module(with DO) #tmp = GPIO.input(DO); # # 2. For Thermister module(with sig pin) if temp > 33: tmp = 0; elif temp < 31: tmp = 1; ################################################# if tmp != status: Print(tmp) status = tmp time.sleep(0.2)
def loop(): count = 0 while True: tmp = ADC.read(0) if tmp < 50: count += 1 print "Voice In!! ", count
def loop(): while True: tmp = ADC.read(0) if tmp < 44: R = 100 G = map(tmp,0, 43, 0, 100) B = 0 elif tmp < 86: R = 100-map(tmp, 44, 85, 0, 100) G = 100 B = 0 elif tmp < 128: R = 0 G = 100 B = map(tmp, 86, 127, 0, 100) elif tmp < 170: R = 0 G = 100-map(tmp, 128, 169, 0, 100) B = 100 elif tmp < 212: R = map(tmp, 170, 211, 0, 100) G = 0 B = 100 elif tmp < 256: R = 100 G = 0 B = 100-map(tmp, 212, 255, 0, 100) setColor(R,G,B) print tmp
def read_illumination(): global CURRENT_ILLUMINATION illumination = ADC.read(0) if (illumination > CURRENT_ILLUMINATION + TOLERANCE_ILLUMINATION or illumination < CURRENT_ILLUMINATION - TOLERANCE_ILLUMINATION): CURRENT_ILLUMINATION = illumination print_line('CURRENT ILLUMINATION: %0.3f' % CURRENT_ILLUMINATION) return True return False
def loop(): count = 0 while True: tmp = ADC.read(0) print tmp time.sleep (0.4) if tmp < 50: count += 1 print "Voice In!! ", count
def get_temperature_sensor_data(self): try: analogTemp = ADC.read(0) Vr = 5 * float(analogTemp) / 255 Rt = 10000 * Vr / (5 - Vr) temp = 1/(((math.log(Rt / 10000)) / 3950) + (1 / (273.15 + 25))) self.temp = (temp - 273.15) * 9/5 + 32 return self.temp except: print "Temp sensor read failed... analog temp = ", analogTemp
def loop(): count = 0 while True: voiceValue = ADC.read(0) if voiceValue: print 'Value:', voiceValue if voiceValue < 50: print "Voice detected! ", count count += 1 time.sleep(0.2)
def sample(): currentRainIntensity = ADC.read(0) data = {} data['rainReading'] = currentRainIntensity # if any rain drop is detected if (lowerBoundary > currentRainIntensity) : data['rainDetected'] = True; else: data['rainDetected'] = False; return data;
def loop(): status = 1 count = 0 while True: print ADC.read(0) tmp = GPIO.input(DO); if tmp != status: Print(tmp) status = tmp if status == 0: count += 1 if count % 2 == 0: GPIO.output(Buzz, 1) else: GPIO.output(Buzz, 0) else: GPIO.output(Buzz, 1) count = 0 time.sleep(0.2)
def loop(): status = 0 while True: res = ADC.read(0) print 'Current intensity of magnetic field : ', res if res - 133 < 5 and res - 133 > -5: tmp = 0 if res < 128: tmp = -1 if res > 138: tmp = 1 if tmp != status: Print(tmp) status = tmp time.sleep(0.2)
def direction(): #get joystick result state = ['home', 'up', 'down', 'left', 'right', 'pressed'] i = 0 if ADC.read(0) <= 5: i = 1 #up if ADC.read(0) >= 250: i = 2 #down if ADC.read(1) >= 250: i = 3 #left if ADC.read(1) <= 5: i = 4 #right if ADC.read(2) == 0: i = 5 # Button pressed if ADC.read(0) - 125 < 15 and ADC.read(0) - 125 > -15 and ADC.read(1) - 125 < 15 and ADC.read(1) - 125 > -15 and ADC.read(2) == 255: i = 0 return state[i]
def loop(): while True: humidity1, temperature1 = DHT.read_retry(Sensor, humiture1) humidity2, temperature2 = DHT.read_retry(Sensor, humiture2) sound_level = ADC.read(0) if humidity1 is not None and temperature1 is not None: import time ts = time.time() import datetime st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') print st + ' : T1={0:0.1f}*C H1={1:0.1f}%'.format(temperature1, humidity1) + ' : T2={0:0.1f}*C H2={1:0.1f}%'.format(temperature2, humidity2) + ' : S1=' + format(sound_level) logging.info(st + ' : T1={0:0.1f}*C H1={1:0.1f}%'.format(temperature1, humidity1) + ' : T2={0:0.1f}*C H2={1:0.1f}%'.format(temperature2, humidity2) + ' : S1=' + format(sound_level)) time.sleep(3600) # delays in seconds (1 hours) else: print 'Failed to get reading. Try again!'
def loop(): status = 1 while True: print 'Value:', ADC.read(0) time.sleep(0.2)
def setup(): print 'Setting up, please wait...' ADC.setup(0x48)
def setup(): ADC.setup(0x48)
def setup(): GPIO.setmode(GPIO.BCM) ADC.setup(0x48) GPIO.setup(DO, GPIO.IN)
def loop(): while True: print ADC.read(0) ADC.write(ADC.read(0))
def destroy(): GPIO.cleanup() ADC.write(0)
def loop(): while True: print "Current illumination: ", ADC.read(1) time.sleep(0.1)
def destroy(): ADC.write(0)
def setup(): ADC.setup(0x48) GPIO.setup(DO, GPIO.IN)
def setup(): ADC.setup(0x48) GPIO.setup (DO, GPIO.IN) GPIO.setup (Buzz, GPIO.OUT) GPIO.output (Buzz, 1)