Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
| × | 4 | ||||
| × | 2 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
| ||||||
| ||||||
| ||||||
Hand tools and fabrication machines | ||||||
|
Years ago, I was exposed to the films of Dario Argento.I immediately felt as though each of these films struck chord deep within.They were like fever dreams, with such a definitive and unique style. No detail was mundane, and nothing could be taken at face value.Even a mechanical doll becomes malice concentrated, albeit for only a moment, before it comes crashing to it's demise, a pile of paper mache and clock parts.
I'm speaking of the ginger haired, paper mache doll from "Profondo Rosso, aka "Deep Red".
It's only in the film for a handful of frames(and doesn't make much sense that it's there at all), but it's so inherently creepy that once you've seen it, you'll always make a visual association between the film and the puppet.
It's disturbing and powerful, and like the best icons, you're never certain exactly why.
I created a physical sculpture of the head in clay. However, I didn't want to make a mold, as I had no intention of doing several reproductions.I decide to use a Matter and Form desktop scanner to import the sculpture into a 3D mesh. I continued refining it in Zbrush before printing the final head on a Prusa Mendel style 3D FDM printer.
The mechanisms were designed in Autodesk Inventor and Openscad.
This robot is probably the simplest of everything I've built, as far as programming goes.
The Mad puppet is driven via Arduino, and an Adafruit I2C 16 channel servo board. When the PIR sensor is tripped by motion, the puppet begins rocking it's head and swinging it's arms back and forth gradually accelerating into a frenzy before coming to a stop, and repeating the cycle again.
Future improvements: I'd like to add additional articulation and a keypad, so as to program different routines with the push of a button.
Here's an early test of everything put together....-ish. Note balance was an issue.
Some shots of the scanned and retouched 3D print
The original prescanned clay model. This all could have been done in software, but I do prefer to work on the actual aesthetic stuff with my hands most of the time.
/*
* 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;
}
}
}
Comments