Pages: [1]   Go Down
Author Topic: Steering wheel arduino control??  (Read 1357 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any way I can make my steering wheel as my keyboard, so that I can control my arduino robot with the steering wheel.
Thanks...oh and here's my code :

I wanted to change 1,2 and 3 to left,right and forward on my steering wheel and pedal.

Thanks afain

#include <Servo.h>

int LedPin1 = 12;
int LedPin = 13;
int MotorPin1 = 9;
int MotorPin2 = 10;
int servoPin = 6;

Servo VishalServo;

void setup()
{
  digitalWrite(LedPin, HIGH);
  Serial.begin(9600);
  Serial.println("Robotic tank");
  pinMode(LedPin, OUTPUT);
  pinMode(LedPin1, OUTPUT);
  pinMode(MotorPin1, OUTPUT);
  pinMode(MotorPin2, OUTPUT);
  VishalServo.attach(servoPin);
  VishalServo.writeMicroseconds(1500);
  Serial.println("Wait for 1 second");
  delay(1000);
  Serial.println("You can now give commands");
}

void loop()
{
  while (Serial.available() == 0);
  int val = Serial.read() - '0';
 
  int i = VishalServo.read();
 
  if (val == 2)
  {
   Serial.println("Robot is On"); 
   digitalWrite(MotorPin1, HIGH);
   digitalWrite(MotorPin2, HIGH);
   delay (500);
   digitalWrite(MotorPin1, LOW);
   digitalWrite(MotorPin2, LOW);
   delay(5);
  }
 
  if (val == 1)
  {
   Serial.println("Robot is turning left");
   digitalWrite(MotorPin2, HIGH);
   delay(500);
   digitalWrite(MotorPin2, LOW);
   delay(5);
  }
 
  if (val == 3)
  {
   Serial.println("Robot is turning right");
   digitalWrite(MotorPin1, HIGH);
   delay(500);
   digitalWrite(MotorPin1, LOW);
   delay(5);
  }
 
  if (val == 9)
  {
  Serial.println("Turning right");
  VishalServo.write(i+5);
  delay(5);
  }
 
   if (val == 7)
  {
  Serial.println("Turning left");
 
  if (i >= 170)
  {
    delay(5);
  }
 
  if(i <= 170)
  {
  VishalServo.write(i-5);
  delay(5);
  }
  }
 
   if (val == 5)
  {
   Serial.println("Shoot");
   digitalWrite(LedPin1, HIGH);
   delay(50);
   digitalWrite(LedPin1, LOW);
   delay(5);
  }
 
  if (val == smiley-cool
  {
    Serial.println("Centering");
    VishalServo.writeMicroseconds(1500);
    delay(5);
  }
 
  else
  {
    delay(5);
  }
}
Logged

Central Europe
Offline Offline
Edison Member
*
Karma: 7
Posts: 1220
Use the Source, Luke.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any way I can make my steering wheel as my keyboard, so that I can control my arduino robot with the steering wheel

Whatever that sentence may mean, the answer is probably yes, you can. Or at least someone could, who has some basic grasp how input devices attached to a PC work and how reactions to those can be sent out on a serial line. But those topics aren't really for the Arduino forum, they belong to general purpose PC programming forum.

Korman
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok fine ...ill delete the post
Logged

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 12
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok fine ...ill delete the post


Vishalapr, I've spent years in countries where I didn't speak the language. Africa. China. Middle East.  English is not yet the universal language. That's OK

But you need to be organized to communicate.

Please try to explain what your robot does, and how it can be controlled. Next talk about how you want a human to control it. Talk about what kind of steering wheel you have.
Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok I have a traceer steering wheel, which is very similar to this :
http://www.tracer.eu/en/Product/TRAJOY07567/TRACER_Steering_Wheel_SpeedDriver_USB_PS2

I would want to use 7 controls on my steering wheel..

2 are the left and right of the steering wheel, then 1 is the accelerator pedal.(Robotic tank movement functions)

Then I have 10 buttons on the steering wheel and I would use any of them for the rest four functions(Dun turret functions)

Thanks
Logged

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 12
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so your Wheel connects like a PS2 Keyboard...

Look at this (use latest at bottom) http://www.arduino.cc/playground/Main/PS2Keyboard
Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No mine is the USB version and I have a bluetooth attached to my arduino so how can I do this wirelessly.
Thanks
Logged

Pages: [1]   Go Up
Jump to: