私は Python-twitter Arduino を使用して、誰かが Twitter で特定のユーザーに言及したときに Arduino ボードのライトをオンにしています。ユーザー名を使用し、この status = api.GetUserTimeline('username') を使用すると、ライトをオンにすることができます。Twitter のどこかで誰かがユーザー名に言及すると、このライトがオンになることをお勧めします。どうすればこれを行うことができますか?
以下はコードの例です。
#status = api.GetUserTimeline('username') ##grab latest statuses
status = api.GetMentions(count=1) ##How get this to work properly?
checkIt = [s.text for s in status] ##put status in an array
drip = checkIt[0].split() ##split first tweet into words
## check for match and write to serial if match
if drip[0] == '#action_go':
print 'Tweet Recieved, Turning the light on!'
ser.write('1')
elif drip[0] == '#action_stop': ##break if done
ser.write('0')
print 'stopped, awaiting instructions.'
else:
ser.write('0')
print 'Awaiting Tweet'