@@ -0,0 +1,783 @@
+# http://www.reuk.co.uk/wordpress/raspberry-pi/ds18b20-temperature-sensor-with-raspberry-pi/%0Aimport os%0Aimport glob%0Aimport time%0Aos.system('modprobe w1-gpio')%0Aos.system('modprobe w1-therm')%0Abase_dir = '/sys/bus/w1/devices/'%0Adevice_folder = glob.glob(base_dir + '28*')%5B0%5D%0Adevice_file = device_folder + '/w1_slave'%0Adef read_temp_raw():%0A  f = open(device_file, 'r')%0A  lines = f.readlines()%0A  f.close()%0A  return lines%0Adef read_temp():%0A  lines = read_temp_raw()%0A  while lines%5B0%5D.strip()%5B-3:%5D != 'YES':%0A    time.sleep(0.2)%0A    lines = read_temp_raw()%0A  equals_pos = lines%5B1%5D.find('t=')%0A  if equals_pos != -1:%0A    temp_string = lines%5B1%5D%5Bequals_pos+2:%5D%0A    temp_c = float(temp_string) / 1000.0%0A    temp_f = temp_c * 9.0 / 5.0 + 32.0%0A    return temp_c, temp_f%0A%0Awhile True:%0A  print(read_temp())%0A

add code for keyes ds18b20 temperature sensor