MrPeanutcrackerful
Published

The Work Glove

This "Work Glove" is a disobedient protest wearable electronic made to protest the notion of modern citizens overworking themselves.

BeginnerShowcase (no instructions)4 hours186
The Work Glove

Story

Read more

Code

The Work Glove

C#
This code measures the position on the accelerometer on the Circuit board express, and checks every 2 seconds if the position of the CPX has changed. If it has not, they it gives a short beeping sound.
#include <Adafruit_CircuitPlayground.h>

float X, Y, Z;
unsigned long time;
float timeA;
float timeB;

void setup() {
  Serial.begin(9600);
  CircuitPlayground.begin();
}

void loop() {
Serial.print("Time: ");
time=millis();
Serial.println(time/1000);

  if   (CircuitPlayground.leftButton()) {
    time=0;
    }

  
 

  Serial.print("X: ");
  Serial.print(X);
  Serial.print("  Y: ");
  Serial.print(Y);
  Serial.print("  Z: ");
  Serial.println(Z);

  if(time%2==0){
     X = floor(CircuitPlayground.motionX());
  Y = floor(CircuitPlayground.motionY());
  Z = floor(CircuitPlayground.motionZ());
 
  if(Y==timeB){
    CircuitPlayground.playTone(700, 200);
  
  }
   timeB=Y;
}

  delay(1000);
}

Credits

MrPeanutcrackerful
4 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.