have a code ...i need shematic

hi
friends and engineers,
i have a arduino code … but i don’t have schematic and wiring .
can some body find schematic
and say ,who wiring in real …
my main question is what is

int leftPin = A0;
int rightPin = A0;
int reversePin = A0;
int neutralPin = A0;
int left_tap = 0;
int right_tap = 0;
int reverse_tap = 0;
int neutral_tap = 0;

its arduino uno .

const int gear1 = 7;
const int gear2 = 6;
const int gear3 = 5;
const int gear4 = 4;
const int gear5 = 3;
const int gearR = 8;

int leftPin = A0;
int rightPin = A0;
int reversePin = A0;
int neutralPin = A0;
int left_tap = 0;
int right_tap = 0;
int reverse_tap = 0;
int neutral_tap = 0;

int gear = 0;

void setup() {
// set the digital pin as output:
pinMode(gear1, OUTPUT);
pinMode(gear2, OUTPUT);
pinMode(gear3, OUTPUT);
pinMode(gear4, OUTPUT);
pinMode(gear5, OUTPUT);
pinMode(gearR, OUTPUT);

digitalWrite(gear1, LOW);
digitalWrite(gear2, LOW);
digitalWrite(gear3, LOW);
digitalWrite(gear4, LOW);
digitalWrite(gear5, LOW);
digitalWrite(gearR, LOW);
}


void loop()
{
left_tap = analogRead(leftPin);
right_tap = analogRead(rightPin);
reverse_tap = analogRead(reversePin);
neutral_tap = analogRead(neutralPin);

if (left_tap > 500)
{

switch (gear) {
case -1:
//do nothing
break;

case 0:
//do nothing
break;

case 1:
//do nothing
break;

case 2:
//downshift to gear 1
digitalWrite(gear2, LOW);
delay(100);
digitalWrite(gear1, HIGH);
gear = 1;
break;

case 3:
//downshift to gear 2
digitalWrite(gear3, LOW);
delay(100);
digitalWrite(gear2, HIGH);
gear = 2;
break;

case 4:
//downshift to gear 3
digitalWrite(gear4, LOW);
delay(100);
digitalWrite(gear3, HIGH);
gear = 3;
break;

case 5:
//downshift to gear 4
digitalWrite(gear5, LOW);
delay(100);
digitalWrite(gear4, HIGH);
gear = 4;
break;

}
}


if (right_tap > 500)
{

switch (gear) {
case -1:
//upshift to gear 0
digitalWrite(gearR, LOW);
delay(100);
gear = 0;
break;

case 0:
//upshift to gear 1
digitalWrite(gear1, HIGH);
gear = 1;
break;

case 1:
//upshift to gear 2
digitalWrite(gear1, LOW);
delay(100);
digitalWrite(gear2, HIGH);
gear = 2;
break;

case 2:
//upshift to gear 3
digitalWrite(gear2, LOW);
delay(100);
digitalWrite(gear3, HIGH);
gear = 3;
break;

case 3:
//upshift to gear 4
digitalWrite(gear3, LOW);
delay(100);
digitalWrite(gear4, HIGH);
gear = 4;
break;

case 4:
//upshift to gear 5
digitalWrite(gear4, LOW);
delay(100);
digitalWrite(gear5, HIGH);
gear = 1;
break;

case 5:
//do nothing
break;

}
}

if (reverse_tap > 500)
{

switch (gear) {
case -1:
//do nothing
break;

case 0:
//shift into reverse
digitalWrite(gearR, HIGH);
gear = -1;
break;

case 1:
//do nothing
break;
case 2:
//do nothing
break;
case 3:
//do nothing
break;
case 4:
//do nothing
break;
case 5:
//do nothing
break;

}

}




if (neutral_tap > 500)
{

digitalWrite(gear1, LOW);
digitalWrite(gear2, LOW);
digitalWrite(gear3, LOW);
digitalWrite(gear4, LOW);
digitalWrite(gear5, LOW);
digitalWrite(gearR, LOW);
gear = 0;

}


}

You have got to be joking. Where did you get the code from? Get the rest of the information from the same place.

i find from internet ...i cant find the source ..
my important problem is
what is :

int leftPin = A0;
int rightPin = A0;
int reversePin = A0;
int neutralPin = A0;
int left_tap = 0;
int right_tap = 0;
int reverse_tap = 0;
int neutral_tap = 0;
int leftPin = A0;
int rightPin = A0;
int reversePin = A0;
int neutralPin = A0;

Multiplexed?

The first 4 lines are assigning human-friendly names to pins to be read, trouble is they are all the same pin (A0) so I have no idea what this is supposed to achieve.

The next 4 lines are declaring variables for use later in the program.

What do you hope to achieve with this code? It seems pretty useless even if you had the hardware.

AWOL:

int leftPin = A0;

int rightPin = A0;
int reversePin = A0;
int neutralPin = A0;



Multiplexed?

maybe is transistor or amplifier
i have a picture ..see below this .can help

There's no other code to suggest a multiplexer - the reads are sequential.

yes .you right .i want use it to control manual transmission .
i have pneumatic valves
i have a picture of that code ,maybe can help

AWOL:
There's no other code to suggest a multiplexer - the reads are sequential.

yes .the read are sequential.
i have a move .
do you want send link?

Graynomad:
The first 4 lines are assigning human-friendly names to pins to be read, trouble is they are all the same pin (A0) so I have no idea what this is supposed to achieve.

The next 4 lines are declaring variables for use later in the program.

What do you hope to achieve with this code? It seems pretty useless even if you had the hardware.

maybe all " A0 " are example and need to be change ....
also i have a picture .
these wirLes go to a ic
that ic is : 18 pin transistor or amplifier or multiplexer or demultiplexer

that ic is : 18 pin transistor or amplifier or multiplexer or demultiplexer

I can't see anything useful but given the application there's a fair chance that an 18-pin IC is a driver like a ULN2803, UDN2981 etc etc (there are 100s of variations).

Graynomad:
I can't see anything useful but given the application there's a fair chance that an 18-pin IC is a driver like a ULN2803, UDN2981 etc etc (there are 100s of variations).

yes you are right it is " ULN2803 "
because ULN2803 can change 5v from arduino to higher voltage for selenoid valve .

how about wireing?
why it called " A0"
this means the A0 from alanog pin arduino .. but at picture ..dont have wire from A0 arduno alanog ...all wires are in (digital pins arduino uno -from 0 to 7) . and then all these wires go to ULN2803
and then all go to selenoid valves .
i dont see something go to A0 alkanog part
or A0 for ULN2803 ?
which A0 here is mean .
arduino A0 or "A0" belong ULN2803 ?

A0 on the Arduino is also a digital pin, and as it's being used for digital that's very bad coding practice to call it A0.

all wires are in (digital pins arduino uno -from 0 to 7) . and then all these wires go to ULN2803

So change the code to use the pins that do have wires on them.

Graynomad:
A0 on the Arduino is also a digital pin, and as it's being used for digital that's very bad coding practice to call it A0.

It's not called A0 in the code but assigned to some 'variables'. And it's probably a lot clearer to most people than the use of number 14

int somepin = 14;

or

int somepin = A0;

Also, the code uses analogRead on the pins that are declared as above and the values are compared against a value of 500.

@batuning
what stops you from creating your own schematic and next write the code for it?

sterretje:
It's not called A0 in the code but assigned to some 'variables'. And it's probably a lot clearer to most people than the use of number 14

int somepin = 14;

or

int somepin = A0;




Also, the code uses analogRead on the pins that are declared as above and the values are compared against a value of 500.

@batuning
what stops you from creating your own schematic and next write the code for it?

i tried ,,but i cant find the exact components place ,push buttons and pins and wiring.
if i have a schematic i can replicate this .
i use Proteus ,and simulated it .after power to A0 analog ..only pin 7 start to work ..signal ..signal ..again and again ..just it
nothing else happen
if i had help .i could do this

because i need help ..just it

Nothing else will happen from an Arduino perspective.

Note that basically all A0 signals will be the same.

  1. You are in neutral, gear == 0.
  2. You apply voltage to A0; all A0 readings are over 500.
    3a) left tap, case 0 -> nothing
    3b) right tap, case 0 -> switch to gear 1 (gear == 1)
    3c) reverse tap, case 1 -> nothing
    3d) neutral tap -> switch to gear 0 (gear == 0)
  3. go back to 2

Easiest is possibly to use 4 buttons, e.g. connected to e.g. A0 to A3 and use digitalRead and debouncing.

int leftPin = A0;
int rightPin = A1;
int reversePin = A2;
int neutralPin = A3;

// remainder of original stuff here
...
...



void setup()
{
  // inputs; connect between pin and GND
  pinMode(leftPin, INPUT_PULLUP);
  pinMode(rightPin, INPUT_PULLUP);
  pinMode(reversePin, INPUT_PULLUP);
  pinMode(neutralPin, INPUT_PULLUP);

  // set the digital pin as output:
  pinMode(gear1, OUTPUT);
  pinMode(gear2, OUTPUT);
  pinMode(gear3, OUTPUT);
  pinMode(gear4, OUTPUT);
  pinMode(gear5, OUTPUT);
  pinMode(gearR, OUTPUT);

  digitalWrite(gear1, LOW);
  digitalWrite(gear2, LOW);
  digitalWrite(gear3, LOW);
  digitalWrite(gear4, LOW);
  digitalWrite(gear5, LOW);
  digitalWrite(gearR, LOW);

}


void loop()
{

  left_tap = digitalRead(leftPin);
  right_tap = digitalRead(rightPin);
  reverse_tap = digitalRead(reversePin);
  neutral_tap = adigitalRead(neutralPin);

  // simulate debounce
  delay(100);

  if(left_tap == LOW)  // was: if(left_tap > 500)
  {
    ...
    ...
  }

  if(right_tap == LOW)  // was: if(right_tap > 500)
  {
    ...
    ...
  }

  if (reverse_tap == LOW)  // was if(reverse_tap > 500)
  {
    ...
    ...
  }

  if (neutral_tap == LOW)  // was if(neutral_tap > 500)
  {
    ...
    ...
  }

}

Conclusion: design your own hardware and design the software around it.

thank you so much ..i try hard for it ...
if i have problem i will say here ..
please take a look here some times ...
thanks once again

it works ...
but'

A0 ------ works
A1------- up shift button works ..but 5th gear freez ..dont off ..
A2 ----act
A3 --- act
a little complex ..i still working on it
can i use 7 segment ?
to show what gear is ?

You could use a seven segment display, but that's a lot more hardware debugging to do, so why not use serial debugging, which just. . . works?