SHARE
TWEET

Python/RPi Tweetbot Example: CPU Temp

w0lfiesmith Aug 29th, 2013 1,785 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. import sys
  3. from twython import Twython
  4. import os
  5.  
  6. CONSUMER_KEY = '***REPLACE WITH YOUR OWN*****'
  7. CONSUMER_SECRET = '***REPLACE WITH YOUR OWN*****'
  8. ACCESS_KEY = '***REPLACE WITH YOUR OWN*****'
  9. ACCESS_SECRET = '***REPLACE WITH YOUR OWN*****'
  10.  
  11. api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET)
  12.  
  13. cmd = '/opt/vc/bin/vcgencmd measure_temp'
  14. line = os.popen(cmd).readline().strip()
  15. temp = line.split('=')[1].split("'")[0]
  16. api.update_status(status='My current CPU temperature is '+temp+' C')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top