Ryan Chan
Published © GPL3+

Chrome Dinosaur Game Controlled in Real Life

Play the Chrome Dinosaur Game in real life using physical movements!

BeginnerFull instructions provided1 hour21,337

Things used in this project

Hardware components

Arduino MKR Zero
Arduino MKR Zero
You can use any board that can be used as a keyboard (Leonardo, Esplora, Zero, Due and MKR Family)
×1
Breadboard (generic)
Breadboard (generic)
×1
Force Sensing Resistor
×1
Stretch Sensor (Conductive Rubber Cord)
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Belt Clip

Schematics

Breadboard Schematic

Code

Code

C/C++
#include <Keyboard.h>

int stretchThreshold = 990;
int forceThreshold = 1000;

void setup() {
  // put your setup code here, to run once:
  Keyboard.begin();
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  int stretchValue = analogRead(A1);
  int forceValue = analogRead(A2);

  Serial.print("stretch: ");
  Serial.print(stretchValue);
  Serial.print(" force: ");
  Serial.println(forceValue);

  if(stretchValue < stretchThreshold){
    digitalWrite(LED_BUILTIN, HIGH);
    Keyboard.press(KEY_DOWN_ARROW);  
    delay(200);
    digitalWrite(LED_BUILTIN, LOW);
  }

  if(forceValue < forceThreshold){
    digitalWrite(LED_BUILTIN, HIGH);
    Keyboard.press(' ');
    delay(200);  
    digitalWrite(LED_BUILTIN, LOW);
  }

  Keyboard.releaseAll();
}

Credits

Ryan Chan

Ryan Chan

9 projects • 231 followers
I like turtles. I also like robots.

Comments