A Shake of the Hand

 

photo

 

I kind of hate it when I meet someone and they give me an unnecessarily strong handshake, so my stupid pet trick deals with that pet peeve of mine. I attached a force sensor to the palm of my hand. When the handshake is too hard, a red light pops up. When it’s just right (or too soft) a green light pops up. Simple as that.

 

Here it is

 

int force;
int green = 8;
int red = 9;

void setup(){
  Serial.begin(9600);
  pinMode(red,OUTPUT);
  pinMode(green,OUTPUT); 
}

void loop(){

  force = analogRead(A1);
  Serial.println(force);
 if(force<300){
   digitalWrite(green,HIGH);}
 if(force>299){
   digitalWrite(red,HIGH);}
 if(force>300){
   digitalWrite(green,LOW);}
  if(force<299){
    digitalWrite(red,LOW);} 

}

 

Leave a Reply