Go Down

Topic: Gearbox shifting (Read 1 time) previous topic - next topic

BurtonCustomX

My go kart's 2-speed transmission can shift with either a pneumatics system, or a servo. Using either I would like to have paddle shifters (like a formula 1 car) and I was hoping someone could give some insight on which is better for physically shifting, and how to build the paddles + code for them (Using RobotOpen protocol https://robotopen.readthedocs.org/en/latest/ )

zoomkat

Simple button code for moving a servo.

Code: [Select]

//zoomkat servo button test 12-29-2011

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
int button2 = 5; //button pin, connect to ground to move servo
int press2 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(170);
  }   
 
  press2 = digitalRead(button2);
  if (press2 == LOW)
  {
    servo1.write(10);
  }
}

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

o_lampe

#2
Oct 03, 2013, 03:10 pm Last Edit: Oct 03, 2013, 03:13 pm by o_lampe Reason: 1
I don't know about your gearbox, but I would add a "throttle closed?" line before I actually move the servo in any direction. Otherwise you might shift under full load.
You would need a NO-pushbutton ( or magnet/reedrelais combo) at the throttle, that closes when the pedal is in idle position.

Code: [Select]

press1 = digitalRead(button2);
throttle = digitalRead(reed-relais);
if (press1 == LOW && throttle == LOW)
 {
   servo1.write(170);
 }    
 
 press2 = digitalRead(button2);
 if (press2 == LOW && throttle ==LOW)
 {
   servo1.write(10);
 }


Go Up