Water Cube

Made by Richard Dong and yxuan

People have busy lives and oftentimes forget to stay hydrated sitting at their desks. Our project aims to remind the user via an ambient visual display to drink their water.

Created: September 27th, 2019

0
0
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created

  // variable to store the servo position

int startpos = 165;
int pos = startpos;  
int endpos = 35;

int drink = 0;

void setup() {
    Serial.begin(9600);
    myservo.attach(D4);   // attach the servo on the D0 pin to the servo object
    myservo.write(startpos);    // test the servo by moving it to 25°
    pinMode(D5, INPUT);
    
    attachInterrupt(D5, did_drink, CHANGE);
}

void loop() {
    // begin API calls on loop, parse and raise or lower servo arm
    if (pos > endpos){
        pos--;
        myservo.write(pos); 
    }

    delay(100);
}

void did_drink() {
    pos = startpos;
    myservo.write(pos); 
    
}
Click to Expand
x
Share this Project

Courses

49313 Designing for the Internet of Things

· 11 members

Thermostats, locks, power sockets, and lights are all being imbued with smarts making them increasingly aware and responsive to their environment and users. This course will chart the emergence of ...more


About

People have busy lives and oftentimes forget to stay hydrated sitting at their desks. Our project aims to remind the user via an ambient visual display to drink their water.