Ibrahim Yassine
Published

The Fishing Bot

A joystick controlled robot for playing the famous fishing game.

BeginnerFull instructions provided7,697
The Fishing Bot

Things used in this project

Hardware components

SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Arduino UNO
Arduino UNO
×1
PS X-Y joystick dual axis
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set

Story

Read more

Code

Fishing bot code

Arduino
Binary file (n
#include <SoftwareSerial.h>
#include<Servo.h> // include server library

Servo ser1;  
Servo ser2;
int potpin1 = A0;  // analog pin used to connect the potentiometer
int potpin2 = A1;
int val;    // variable to read the value from the analog pin

void setup() {
  ser1.attach(9);
  ser2.attach(8);// attaches the servo on pin 9 to the servo object
}

void loop() {
  val = analogRead(float(potpin2));            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 60);     // scale it to use it with the servo (value between 0 and 180)
  ser1.write(val);                  // sets the servo position according to the scaled value
  delay(100); // waits for the servo to get there

  val = analogRead(float(potpin1));            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 40);     // scale it to use it with the servo (value between 0 and 180)
  ser2.write(val);                  // sets the servo position according to the scaled value
  delay(100);

}o preview)

Credits

Ibrahim Yassine

Ibrahim Yassine

4 projects • 7 followers

Comments