Suivre le biofeedback d'une plante verte et envoyer la valeur arbitraire de ce biofeedback sur Twitter Le biofeedback de notre yucca sur https://twitter.com/#!/yuccalive
La valeur de biofeedback reste complètement relative, c'est à dire qu'elle ne représente pas une mesure absolue, mais plutot à considérer dans le temps en observant finement les évolutions de celle-ci
Script Bash qui permet d'envoyer des Tweet, il faut changer le username et le password selon votre compte twitter dans le script, le message à twitter se passe avec la commande :
bash tweet.sh "My new tweet!"
#!/bin/bash #Twitter status update bot by http://360percents.com #Author: Luka Pusic <pusic93@gmail.com> # #bash tweet.sh "My new tweet!" # #bash tweet.sh $(cat file.txt) # #or, alternatively: # #note the special quotes # bash tweet.sh `cat file.txt` #REQUIRED PARAMS username="yuccalive" password="****************" tweet="$*" #must be less than 140 chars #EXTRA OPTIONS uagent="Mozilla/5.0" #user agent (fake a browser) sleeptime=0 #add pause between requests if [ $(echo "${tweet}" | wc -c) -gt 140 ]; then echo "[FAIL] Tweet must not be longer than 140 chars!" && exit 1 fi if [ "$tweet" = "" ]; then echo "[FAIL] Nothing to tweet. Enter your text as argument." && exit 1 fi touch "cookie.txt" #create a temp. cookie file #INITIAL PAGE echo "[+] Fetching twitter.com..." && sleep $sleeptime initpage=`curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" "https://mobile.twitter.com/session/new"` token=`echo "$initpage" | grep "authenticity_token" | sed -e 's/.*value="//' | sed -e 's/" \/>.*//'` #LOGIN echo "[+] Submitting the login form..." && sleep $sleeptime loginpage=`curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" -d "authenticity_token=$token&username=$username&password=$password" "https://mobile.twitter.com/session"` #HOME PAGE echo "[+] Getting your twitter home page..." && sleep $sleeptime homepage=`curl -s -b "cookie.txt" -c "cookie.txt" -L -A "$uagent" "http://mobile.twitter.com/"` #TWEET echo "[+] Posting a new tweet: ${tweet}..." && sleep $sleeptime tweettoken=`echo "$homepage" | grep "authenticity_token" | sed -e 's/.*value="//' | sed -e 's/" \/>.*//' | tail -n 1` update=`curl -s -b "cookie.txt" -c "cookie.txt" -L -A "$uagent" -d "authenticity_token=$tweettoken&tweet[text]=$tweet&tweet[display_coordinates]=false" "http://mobile.twitter.com/"` #LOGOUT echo "[+] Logging out..." logout=`curl -s -b "cookie.txt" -c "cookie.txt" -L -A "$uagent" "http://mobile.twitter.com/session/destroy"` rm "cookie.txt"
Le script bash à télécharger et à décompresser : Tweet.sh.zip
Le patch Pure Data qui permet de solliciter ce script et d'y passer un paramètre Twittercurl.pd, utilise la fonction [shell] et fonctionne donc plutôt sous Linux en lançant Pure Data depuis un terminal
Le patch Pure Data qui fait le lien entre Arduino et le script d'envoi des messages à Twitter PlanteVerte2Arduino2Twitter.zip