Пример #1
0
        def on_data(self,data):
                #Convert the JSon object to unicode
                try:
                        y = json.loads(data)
                        name = y['user']['name']
                        at = y['user']['screen_name']
                        tweet = y['text']
                        loc = y['user']['location']
                        ti = y['created_at']
                        print at,'      ',name,'        ',tweet,'       ',loc,' ',ti
                        print
			if (u'@becon_hug' in tweet) or (u'@BeCon_Hug' in tweet) or (u'@Becon_Hug' in tweet):
				if (u'beconhug' in tweet) or (u'BeconHug' in tweet): #or (u'#beconhug' in tweet):
					lcd.on_lcd('@'+str(at),1)
					sol.write(1)
                			pump.write(1)
                			s(3)
                			pump.write(0)
					s(5)
					sol.write(0)
					s(4)
					return False
						
                except KeyError:
                        pass
Пример #2
0
def calibration():
	t1 = t()
	t2 = 0
	i = 0
	calVal = 0
	while (t2-t1) <20:
		potVal = float(pot.read())
	    	calVal =  potVal + calVal
		i +=1
		t2 = t()
	calVal = (calVal/i)
	lcd.on_lcd('Calibrated: '+str(calVal),3)
	return calVal
Пример #3
0
def main():
	x = 0
	calVal = calibration()
	while True:
	        lcd.on_lcd('cute',2)
		potVal = float(pot.read())
		stdAcc = []
		while potVal < (calVal+calVal*0.05):
			potVal = float(pot.read())
			stdAcc.append(float(galv.read()))
			s(0.001)
			if len(stdAcc) == 8000:
				stdAcc = []
		if (stDev(stdAcc) < 70) and (temp_check() < 35):
			sendTweet('I\'m stressed #beconhug '+str(locT().tm_hour-5)+':'+str(locT().tm_min))
			s(1)
			go()
Пример #4
0
def go():
	x = 0
	print 'Live!'
	lcd.on_lcd('cute',4)
	x =Stream(auth,X()).filter(track =['beconhug'])
	s(10)