Пример #1
0
def tweet_():
	
	#Read temp and light level.
	tw_temp_c = temp.read_temp_c()
	tw_light = light.RCtime(22)
	
	#Load the date and time.
	now = datetime.datetime.now()
	
	#Format time like bash shell.
	dateF = now.strftime("%a %b %d %H:%M CDT %Y")

	#Set Tweet contents.
	tweettext = "The lights are currently " + str(tw_light) + ".\nThe current water temperature is: " + str(tw_temp_c) + u'\xB0' + "C \nPrepared: " + str(dateF)
	
	#Send the Tweet.
	print tweet.tweet(tweettext.encode('UTF-8'))

	#Blink the Blue LED.
	led.blink(25, 1)
Пример #2
0
def monitor_():

	#Read temp and light level.
	mon_temp_c = temp.read_temp_c()
	mon_light = light.RCtime(22)
	mon_pH = 7.0
	mon_DO = 97
	timenow = datetime.datetime.now().time()
	datenow = datetime.date.today()

	#Write sensor data to csv file.
	dcontrol.datawrite(mon_temp_c, mon_pH, mon_DO, datenow, timenow, str(datenow) + " " + str(timenow))

	#Blink LED based on temp.
	if mon_temp_c < 24:
		led.blink(25, 1)
	elif mon_temp_c <= 27:
		led.blink(23, 1)
	elif mon_temp_c > 27:
		led.blink(18, 1)
	else:
		pass
	print str(mon_temp_c) + str(mon_light)