Alert project



Im working on a project where i want to use i sound sensor to alert me when its activated. I´ve tried using file and just modify it to send me a notification on twitter. this might be naive of me, but can i just add part of the code found in the

something in the lines of:

while True:
# Read the sound level
sensor_value = grovepi.analogRead(sound_sensor)

    # If loud, illuminate LED, otherwise dim
    if sensor_value > threshold_value:
    print (what ever i want the message to be)
    api.PostUpdate(what ever i want the message to be)




You will need to instigate your Twitter connection first with this line:
api = twitter.Api(consumer_key=‘YourKey’,consumer_secret=‘YourKey’,access_token_key=‘YourKey’,access_token_secret=‘YourKey’)

and of course, you have to go to Twitter, and create your API connection there. You need all four keys that will be generated by Twitter. consumer_key, consumer_secret, access_token_key and access_token_secret


thanks for the reply. i´ve generated the four keys from twitter and entered in the “yourkey” spaces. but when i try to run the program i get error whith the “import twitter”. Im guessing i´ll need some files to make that work, just like i needed to run the to get the import grovepi command to work?


Yes, you do need the twitter library, sorry about that. I totally forgot that step
Launch a terminal window
type in
pip install python-twitter

Let me know if that works for you