Claudio_Canavese
Published © GPL3+

Ariadne's Thread

Ariadne's Thread is a project born to fulfill the wish to automate an old game.

BeginnerShowcase (no instructions)1,927
Ariadne's Thread

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Analog joystick (Generic)
×1
USB-A to B Cable
USB-A to B Cable
×1
Samsung 5V 1A Power Supply
You can use any type, just be sure it is 5V
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Electrical Connections

The following image shows the electrical connections, the joystick is replaced with two potentiometers since it is not present in the software.

Code

servo.ino

Arduino
#include <Servo.h>

Servo piana;
Servo padella;
int pot1 = A0;
int pot2 = A1;
int val1 = 0;
int val2 = 0;

void setup() {
  piana.attach(9);
  padella.attach(10);
  pinMode (pot1, INPUT);
  pinMode (pot2, INPUT);
  Serial.begin(9600);
}

void loop() {
  val1 = analogRead(pot1);
  if (val1 <= 513) {
    val1 = map(val1, 0, 1023, 70, 110);
  }
  else {
    val1 = map(val1, 0, 1023, 60, 120);
  }
  piana.write(val1);
  val2 = analogRead(pot2);
  val2 = map(val2, 0, 1023, 75, 105);
  padella.write(val2);
  delay(15);

}

Credits

Claudio_Canavese
1 project • 1 follower

Comments