Project #12: Robotics – Joystick – Mk35

——

#DonLucElectronics #DonLuc #Robotics #Joystick #L298N #MotorDC #SparkFunRedBoard #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Joystick

——

Joystick

——

Joystick

——

Thumb Joystick

The classic ‘PS2-style’ analog joystick. Features smooth dual-axis control (two 10k pots) and a satisfying integrated push-button click.

SparkFun Thumb Joystick Breakout

Stop struggling with weird pin spacing. This breakout board routes the Thumb Joystick connections to a standard 0.1″ header for easy breadboarding.

DL2603Mk01

1 x SparkFun RedBoard Qwiic
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x L298N DC Motor Driver Module
2 x Motor DC
1 x Power Switch
1 x 18650 Battery Holder (11 Volts)
3 x 18650 Battery
1 x Micro USB Cable

DL2603Mk01p

DL2603Mk01p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #12: Robotics - Joystick - Mk35
12-35
DL2603Mk01p.ino
DL2603Mk01
1 x SparkFun RedBoard Qwiic
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x L298N DC Motor Driver Module
2 x Motor DC
1 x Power Switch
1 x 18650 Battery Holder (11 Volts)
3 x 18650 Battery
1 x Micro USB Cable
*/

// Include the Library Code

// Joystick
// Vertical
const int VERT = A0;
int vertical;
// Horizontal
const int HORIZ = A1;
int horizontal;
// Sel
const int SEL = 7;
int select;

// Motor DC 1 
int motor1pin1 = 2;
int motor1pin2 = 3;

// Motor DC 2
int motor2pin1 = 4;
int motor2pin2 = 5;

// Software Version Information
String sver = "12-35";

void loop() {

  // is Joystick
  isJoystick();

}

getJoystick.ino

// Joystick
// is Joystick
void isJoystick(){

  // Vertical
  vertical = analogRead(VERT);

  // Moving Forward
  if (vertical < 20) {
      
    // Moving Forward
    digitalWrite(motor1pin1, HIGH);
    digitalWrite(motor1pin2, LOW);
    digitalWrite(motor2pin1, HIGH); 
    digitalWrite(motor2pin2, LOW);    
    
  }
  
  // Moving Backwards
  if (vertical > 500) {
    
    // Moving Backwards
    digitalWrite(motor1pin1, LOW);
    digitalWrite(motor1pin2, HIGH);
    digitalWrite(motor2pin1, LOW); 
    digitalWrite(motor2pin2, HIGH);
  
  }

  // Horizontal
  horizontal = analogRead(HORIZ);

  // Moving Right
  if (horizontal < 25){

    // Moving Right
    digitalWrite(motor1pin1, LOW);
    digitalWrite(motor1pin2, HIGH);
    digitalWrite(motor2pin1, LOW); 
    digitalWrite(motor2pin2, LOW);

  }

// Moving Left
  if (horizontal > 500 ){

    // Moving Left
    digitalWrite(motor1pin1, LOW);
    digitalWrite(motor1pin2, LOW);
    digitalWrite(motor2pin1, LOW); 
    digitalWrite(motor2pin2, HIGH);

  }

  // LOW (0) if pressed
  select = digitalRead(SEL);

  // Select
  if (select == LOW) {
      
    // Stop
    digitalWrite(motor1pin1, LOW);
    digitalWrite(motor1pin2, LOW);
    digitalWrite(motor2pin1, LOW); 
    digitalWrite(motor2pin2, LOW);

  }

}

setup.ino

// Setup
void setup()
{
 
  // Motor DC 1
  pinMode(motor1pin1, OUTPUT);
  pinMode(motor1pin2, OUTPUT);

  // Motor DC 2
  pinMode(motor2pin1, OUTPUT);
  pinMode(motor2pin2, OUTPUT);

  // SEL Input
  pinMode(SEL, INPUT_PULLUP);

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Leave a Comment