Making my plant to say more things

Home Forums Botanicalls Community Making my plant to say more things

This topic contains 0 replies, has 1 voice, and was last updated by  sved 7 years, 8 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1507

    sved
    Participant

    Hi all,

    I tried to modify the code of the botnaicalls through arduino but am still a beginner in it. Basically, I wanted the plant to say something different for different level of humidity. To do so, i added more tweets, more variables and replicated the code part for intermediate values. My problem, when the humidity is too high, the plant tweets repeatedly the higher value I put (625)… you can check it here https://twitter.com/#!/Live_nature

    I’ll try to put here the parts of the code I modified compared to the original one, every help is very welcome!

    #define TWEET_DRY “Oh I am SO thirsty” //300

    #define TWEET_DRYA “No, really, I need water” //325

    #define TWEET_DRYB “What about a drink? Or two?” //350

    #define TWEET_DRYC “Is it just me or it’s dry here?” //375

    #define TWEET_DRYD “Nice weather, a bit dry though” //400

    #define TWEET_MOIST “Maybe a bit of fresh air?” //425

    #define TWEET_MOISTA “I just love the smell around” //450

    #define TWEET_MOISTB “I like the ambient here, very cosy” //475

    #define TWEET_MOISTC “Like bloomin’ all over again” //500

    #define TWEET_MOISTD “Isn’t today the perfect day?” //525

    #define TWEET_MOISTE “That’s the way I like it” //550

    #define TWEET_SOAKED “This is just perfect” //575

    #define TWEET_SOAKA “Hmmmmmmm… nice” //600

    #define TWEET_SOAKB “This soil feels SO good” //625

    #define TWEET_SOAKC “It’s a bit on the wet side” //650

    #define TWEET_SOAKD “Damp & humid, tropical style” //675

    #define TWEET_SOAKE “I forgot my swimsuit…” //700

    #define TWEET_SOAKF “Yes I like water, but…” //725

    #define TWEET_SOAKG “Oh dear, I’m drowning” //750

    #define THANK_YOU “Much appreciated, thanks!”

    #define OVER_WATERED “Thanks, but I just been watered”

    #define UNDER_WATERED “A bit more, please?”

    And in the checks tab:

    ///return values

    if ((moistAverage < 300) && (lastMoistAvg >= 300) && state < 15 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“DRY tweet”);

    posttweet(TWEET_DRY); // announce to Twitter

    state = 15; // remember this message

    }

    else if ((moistAverage < 325) && (lastMoistAvg >= 325) && state < 14 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“DRYA tweet”);

    posttweet(TWEET_DRYA); // announce to Twitter

    state = 14; // remember this message

    }

    else if ((moistAverage < 350) && (lastMoistAvg >= 350) && state < 13 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“DRYB tweet”);

    posttweet(TWEET_DRYB); // announce to Twitter

    state = 13; // remember this message

    }

    else if ((moistAverage < 375) && (lastMoistAvg >= 375) && state < 12 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“DRYC tweet”);

    posttweet(TWEET_DRYC); // announce to Twitter

    state = 12; // remember this message

    }

    else if ((moistAverage < 400) && (lastMoistAvg >= 400) && state < 11 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“DRYD tweet”);

    posttweet(TWEET_DRYD); // announce to Twitter

    state = 11; // remember this message

    }

    else if ((moistAverage < 425) && (lastMoistAvg >= 425) && state < 10 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“MOIST tweet”);

    posttweet(TWEET_MOIST); // announce to Twitter

    state = 10; // remember this message

    }

    else if ((moistAverage < 450) && (lastMoistAvg >= 450) && state < 9 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“MOISTA tweet”);

    posttweet(TWEET_MOISTA); // announce to Twitter

    state = 9; // remember this message

    }

    else if ((moistAverage < 475) && (lastMoistAvg >= 475) && state < 8 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“MOISTB tweet”);

    posttweet(TWEET_MOISTB); // announce to Twitter

    state = 8; // remember this message

    }

    else if ((moistAverage < 500) && (lastMoistAvg >= 500) && state < 7 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“MOISTC tweet”);

    posttweet(TWEET_MOISTC); // announce to Twitter

    state = 7; // remember this message

    }

    else if ((moistAverage < 525) && (lastMoistAvg >= 525) && state < 6 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“MOISTD tweet”);

    posttweet(TWEET_MOISTD); // announce to Twitter

    state = 6; // remember this message

    }

    else if ((moistAverage < 550) && (lastMoistAvg >= 550) && state < 5 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“MOISTE tweet”);

    posttweet(TWEET_MOISTE); // announce to Twitter

    state = 5; // remember this message

    }

    else if ((moistAverage < 575) && (lastMoistAvg >= 575) && state < 4 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“SOAKEDA tweet”);

    posttweet(TWEET_SOAKA); // announce to Twitter

    state = 4; // remember this message

    }

    else if ((moistAverage < 600) && (lastMoistAvg >= 600) && state < 3 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“SOAKEDB tweet”);

    posttweet(TWEET_SOAKB); // announce to Twitter

    state = 3; // remember this message

    }

    else if ((moistAverage < 625) && (lastMoistAvg >= 625) && state < 2 && (millis() > (lastTwitterTime + TWITTER_INTERVAL)) ) {

    Serial.println(“SOAKEDC tweet”);

    posttweet(TWEET_SOAKC); // announce to Twitter

    state = 2; // remember this message

    }

    else if (moistAverage > 625) {

    state = 1; // reset to messages not yet sent state

    }

    lastMoistAvg = moistAverage; // record this moisture average for comparison the next time this function is called

    moistLight(moistAverage);

    }

    }

    I guess it’s quite a dirty way, so any advice or direction would be helpful, thanks!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.



New kits are here!

Categories

Pothos Plant Tweets

    Flickr Feed

    www.flickr.com
    More photos or video tagged with botanicalls on Flickr

    Meta