This post contains the arduino source code and wire connection diagram to reproduce the Chrome Dinosaur automation as shown in the video.
Video
Arduino code
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int sensorPin = A0;
int sensorValue = 0;
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.print("value: ");
Serial.println(sensorValue);
// compare according to threshld
if (sensorValue < 200) {
myservo.write(35); // change according to how much the servo needs to move
delay(250);
myservo.write(20); // same as above
}
}
Or click here to download file with code