BabyBumper

Created Date: 2015-05-07/ updated date: 2018-03-13
    Owner & Collaborators
    License
    Summary
    Wearable belly protector for pregnant women.

    Memo

    Belly Protector

    posted by risaHiyama on May 09, 2015
    This is a part of the code.
    Instead of sowing the bending sensor to the belly protector, 
    we decided to sow magic tape so that we can arrange the sensor 
    and do experiment on what position works the most. 


    import processing.serial.*;
    import cc.arduino.*;
    Arduino arduino;
    int MAGE1 = 0;
    int MAGE2 = 1;
    int MAGE3 = 2;
    int MAGE4 = 3;
    int kick1 = 0; 
    int kick2 = 0; 
    int kick3 = 0;
    int kick4 = 0;
    int pat1 = 0; int pat2 = 0; int pat3 = 0; int pat4 = 0;
    int analog0, analog1, analog2, analog3;

    void setup() {
      size(1000, 480);
      arduino = new Arduino(this, "/dev/tty.usbmodem1411"); 
      arduino.pinMode(MAGE1, Arduino.INPUT);
      arduino.pinMode(MAGE2, Arduino.INPUT);
      arduino.pinMode(MAGE3, Arduino.INPUT);
      arduino.pinMode(MAGE4, Arduino.INPUT);
    }

    void draw() {
      background(255, 245, 238);
      fill(255);
      analog0 = arduino.analogRead(MAGE1);
      analog1 = arduino.analogRead(MAGE2);
      analog2 = arduino.analogRead(MAGE3);
      analog3 = arduino.analogRead(MAGE4);
      
      display();
      checkKick();
      checkStroke();
      checkPat();
    }

    void display() {
      fill(233, 150, 122);

      text("Left", width/5*4-15, height/3);
      text("Right", width/5-15, height/3);

      text("MAGE1 = " + analog0 + ", " + kick1 + ", " + pat1, 10, 20);
      text("MAGE2 = " + analog1 + ", " + kick2, 10, 40);
      text("MAGE3 = " + analog2 + ", " + kick3, 10, 60);
      text("MAGE4 = " + analog3 + ", " + kick4, 10, 80);

      fill(233, 150, 122);
      noStroke();
      ellipse(width/5, height/2, analog0/5, analog0/5);
      ellipse(width/5*2, height/2, analog1/5, analog1/5);
      ellipse(width/5*3, height/2, analog3/5, analog3/5);
      ellipse(width/5*4, height/2, analog2/5, analog2/5);
    }

    Comments