lefthandsh8k
Published

The Mad Puppet

A super creepy little robotic puppet that activates when you walk by. Inspired by the 60 and 70's Giallo movies of Dario Argento.

IntermediateShowcase (no instructions)Over 2 days1,898
The Mad Puppet

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Standard servo - TowerPro SG-5010
×4
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Adafruit 16-Channel 12-bit PWM/Servo Shield - I2C interface
Adafruit 16-Channel 12-bit PWM/Servo Shield - I2C interface
×1

Software apps and online services

zbrush
Fusion 360
Autodesk Fusion 360
openscad

Hand tools and fabrication machines

Wan Hao I3 duplicator

Story

Read more

Code

Mad Puppet

Arduino
PIR sensor is tripped, and the robot has a little tantrum.
/*
* PIR sensor tester
*/
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
//#include <Servo.h>
//int laughPin=13;
int inputPin=2;
int pirState=LOW;
int val=0;
//int NECKx;
//int pos = 0;
//Servo myservo;  // create servo object to control a servo
  uint16_t NECKx  = 0; 
  uint16_t NECKy = 1;
  uint16_t Rshoulder=2;
  uint16_t Lshoulder=3;
  uint16_t Relbow=4;
  uint16_t Lelbow=5;
  uint16_t Lhand=6;
  uint16_t Rhand=7;

  
  int NECKPOS = 165;          // assigned value
//  int NECKPOS1 = 200;         // assigned value
  int NECKPOS2 = 400;           // assigned value
  
  int ALTPOS =  0;         
  int ALTPOS1 = 100;      
  int ALTPOS2 = 200;           
  int ALTPOS3 = 300;
  int ALTPOS4 = 400;

void setup(){
 // pinMode(laughPin,OUTPUT);
  pinMode(inputPin,INPUT);//declare sensor as input
#define SERVOMIN  150          // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  400          // this is the 'maximum' pulse length count (out of 4096)



  
  Serial.begin(9600);
  pwm.begin();
  pwm.setPWMFreq(60);
}
/***********************************************************************/


void setServoPulse(uint8_t n, double pulse) {
 double pulselength;
  
pulselength = 1000000;   // 1,000,000 us per second
pulselength /=60;   // 60 Hz
 //Serial.print(pulselength); Serial.println(" us per period"); 
 pulselength /= 4096;  // 12 bits of resolution
  //Serial.print(pulselength); Serial.println(" us per bit"); 
pulse *= 1000;
pulse /= pulselength;
// Serial.println(pulse);
 pwm.setPWM(n,0,pulse);

}

/**********************************************************************/
void loop(){
  val= digitalRead(inputPin);
  
    if(val==HIGH){ //the sensor has a change in state 
      Serial.println("Motion detected!");
      pirState = HIGH;
      // We only want to print the output change, not the state
          pwm.setPWM(NECKx, 0, NECKPOS);
   delay(500); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(500); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(500); 
          pwm.setPWM(NECKy, 0, NECKPOS2);
 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
                 
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(500);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(500);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(500);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);

 /*******************************************************************/

          pwm.setPWM(NECKx, 0, NECKPOS);
   delay(450); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(450); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(450); 
          pwm.setPWM(NECKy, 0, NECKPOS2);

 
pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(450);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(450);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(450);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(450);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);


 /*******************************************************************/

         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(400); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(400); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(400); 
          pwm.setPWM(NECKy, 0, NECKPOS2);



 
 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(400);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(400);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(400);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(400);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);


     
  /*******************************************************************/

         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(350); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(350); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(350); 
          pwm.setPWM(NECKy, 0, NECKPOS2);


  
 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(350);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(350);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(350);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(350);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/

         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(300); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(300); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(300); 
          pwm.setPWM(NECKy, 0, NECKPOS2);



 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(300);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(300);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(300);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(300);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/

         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(250); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(250); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(250); 
          pwm.setPWM(NECKy, 0, NECKPOS2);

 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(250);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(250);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(250);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(250);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/


         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(200); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(200); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(200); 
          pwm.setPWM(NECKy, 0, NECKPOS2);

 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(200);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(200);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(200);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(200);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/
         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(150); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(150); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(150); 
          pwm.setPWM(NECKy, 0, NECKPOS2);

 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(150);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(150);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(150);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(150);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/
         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(100); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(100); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(100); 
          pwm.setPWM(NECKy, 0, NECKPOS2);

 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(100);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(100);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(100);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(100);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/
         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(50); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(50); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(50); 
          pwm.setPWM(NECKy, 0, NECKPOS2);

 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(50);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(50);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(50);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(50);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/

         pwm.setPWM(NECKx, 0, NECKPOS);
   delay(25); 
          pwm.setPWM(NECKx, 0, NECKPOS2);
     delay(25); 
            pwm.setPWM(NECKy, 0, NECKPOS);
        delay(25); 
          pwm.setPWM(NECKy, 0, NECKPOS2);
 pwm.setPWM(Rshoulder, 0, ALTPOS); pwm.setPWM(Relbow, 0, ALTPOS);pwm.setPWM(Rhand, 0, ALTPOS);  pwm.setPWM(Lshoulder, 0, ALTPOS4);  pwm.setPWM(Lelbow, 0, ALTPOS4);pwm.setPWM(Lhand, 0, ALTPOS4);
          delay(25);         
 pwm.setPWM(Rshoulder, 0, ALTPOS1); pwm.setPWM(Relbow, 0, ALTPOS1);pwm.setPWM(Rhand, 0, ALTPOS1); pwm.setPWM(Lshoulder, 0, ALTPOS3); pwm.setPWM(Lelbow, 0, ALTPOS3);pwm.setPWM(Lhand, 0, ALTPOS3);
          delay(25);
 pwm.setPWM(Rshoulder, 0, ALTPOS2);pwm.setPWM(Relbow, 0, ALTPOS2);pwm.setPWM(Rhand, 0, ALTPOS2);pwm.setPWM(Lshoulder, 0, ALTPOS2); pwm.setPWM(Lelbow, 0, ALTPOS2);pwm.setPWM(Lhand, 0, ALTPOS2);
          delay(25);
 pwm.setPWM(Rshoulder, 0, ALTPOS3);pwm.setPWM(Relbow, 0, ALTPOS3);pwm.setPWM(Rhand, 0, ALTPOS3);pwm.setPWM(Lshoulder, 0, ALTPOS1); pwm.setPWM(Lelbow, 0, ALTPOS1);pwm.setPWM(Lhand, 0, ALTPOS1);
          delay(25);
 pwm.setPWM(Rshoulder, 0, ALTPOS4);pwm.setPWM(Relbow, 0, ALTPOS4);pwm.setPWM(Rhand, 0, ALTPOS4);pwm.setPWM(Lshoulder, 0, ALTPOS);pwm.setPWM(Lelbow, 0, ALTPOS2); pwm.setPWM(Lhand, 0, ALTPOS);
 
/*********************************************************************/;

       

  } else {
    if (pirState == HIGH){
      // we have just turned off
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}

Credits

lefthandsh8k

lefthandsh8k

4 projects • 5 followers
Modeler / prototyping. Sometimes I make monsters for movies. I just love robots and try to inject personality into my projects.

Comments