<file_sep>import time
import board
import adafruit_lis3dh
#altered to show alt readings

# Software I2C setup:
import bitbangio
i2c = bitbangio.I2C(board.SCL, board.SDA)
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c)

# Set range of accelerometer (can be RANGE_2_G, RANGE_4_G, RANGE_8_G or RANGE_16_G).
lis3dh.range = adafruit_lis3dh.RANGE_2_G

# Loop forever printing accelerometer values
while True:
    # Read accelerometer values (in m / s ^ 2).  Returns a 3-tuple of x, y,
    # z axis values.
    x, y, z = lis3dh.acceleration
    print('x = {}G, y = {}G, z = {}G'.format(1-(x / 9.806), 1-(y / 9.806), 1-(z / 9.806))
    # Small delay to keep things responsive but give time for interrupt processing.
    time.sleep(0.1)<file_sep>set pswd = mangonada
sudo chown quintosol2 /dev/ttyUSB0 $pswd
<file_sep>//network config
#include "config.h"
AdafruitIO_Feed *input = io.feed("state");

//analog acc reqs
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
//for software SPI
#define LIS3DH_CLK 13
#define LIS3DH_MISO 12
#define LIS3DH_MOSI 11
//for hardware & software SPI
#define LIS3DH_CS 10
Adafruit_LIS3DH lis = Adafruit_LIS3DH();

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif
//variables for three axis
int io; int state;
int ax; int ay; int az;
int bx; int by; int bz;
int nAn; int fox; int rabbit; int duck; int dinner;


void setup() {
  // start the serial connection
  #ifndef ESP8266
  while (!Serial);     // will pause Zero, Leonardo, etc until serial console opens
  #endif

  Serial.begin(115200);
  while (!Serial);

  if (! lis.begin(0x18)) {   // change this to 0x19 for alternative i2c address
    Serial.println("Couldnt start");
    while (1);
  }
      //connect to net
  Serial.println("Connecting to Adafruit IO");
  io.connect();
  Serial.println();
    // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println();
  Serial.println(io.statusText());
  //setting range for sensor, reccomend 2G at first
  lis.setRange(LIS3DH_RANGE_4_G);   // 2, 4, 8 or 16 G!

  Serial.print("Range = "); Serial.print(2 << lis.getRange());
  Serial.println("G");
}

void loop(){
  io.run();

  nAn = 200;
  io = 0;
  while (io < 10){
  // grab the one state of the acc
    lis.read();
    state = 0;
    //input ->save(state);
    ax = lis.x; ay = lis.y; az = lis.z;

  //get new number to be compared against
    delay(250);
    lis.read();
    bx = lis.x; by = lis.y; bz = lis.z;

    //FOX FOX FOX FOX FOX FOX FOX FOX FOX FOX FOX FOX
    if(abs(bx - ax) <= nAn){
      fox = 0; //not moving
      }
    else{
      fox = 1; //still moving
    }
    //DUCK DUCK DUCK DUCK DUCK DUCK DUCK DUCK DUCK DUCK
    if(abs(bx - ax) <= nAn){
      fox = 0; //not moving
      }
    else{
      fox = 1; //still moving
    }
    //RABBIT RABBIT RABBIT RABBIT RABBIT RABBIT RABBIT
    if(abs(bx - ax) <= nAn){
      fox = 0; //not moving
      }
    else{
      fox = 1; //still moving
    }
    dinner = fox + rabbit + duck;
   //DINNER DINNER DINNER DINNER DINNER DINNER DINNER DINNER DINNER DINNER
    if (dinner > 0){
      io =0;
//      Serial.println("Counter: ");
      Serial.println(io);
      }
    else{
      io++;
//      Serial.println("Counter: ");
      Serial.println(io);
      }
     io = abs(io);
     delay(500);
    }

  if(io >= 10){
    Serial.println("The Laundry is Done!!!");
    SaveState(1);
    return;
  }
  delay(1000);
  SaveState(0);
}

void SaveState(int state){
  input->save(state);

}

Boolean Movement(int r1, int r2){
  return (abs(r2 -r1) <= nAn);
}
<file_sep>Washer Machine Remote Monitoring 2016/17

This project has been developed for being able to use an Adafruit Huzzah Microcontroller along with an 3-axis accelerometer 

I developed this after being frustrated with living in the fourth floor of my university dorm room and going downstairs to realize that my laundry had not finished only

The way it functions is by taking readings from the LIS3DH Accelerometer Module during a set interval of measure

After the entire wash cycle has completed the board will compare the data to previous measurments and determine if it is done

Once the Microcontroller has determined that the wash is done it will transmit to the io.adafruit website where there is a feed that monitors the output of the board

The method I decided to go with notifying the user that the laundry is done is by integrating an IFTTT applet that monitor that feed and from there an array of things can be triggered to notify the user such as sms message, google/apple calendar integration




