retrolefty:
I think you really need to post your code and wiring drawing for anyone to have a chance at helping you. You are using series current limiting resistors for the base connections to your two transistors, right?Lefty
yes yes, I am. Before I show you the code could I use MOSFETS in place of the transistors? If so, what type would I need N-type?
Lastly, what is the difference between using a MOSFET for this and a normal transistor?
ok here's the code : int Lm = 5;
int Rm = 3;
int lval = 0;
int rval = 0;
int Ls = 4;
int Rs = 5;
void setup() {
pinMode(Lm, OUTPUT);
pinMode(Rm, OUTPUT);
Serial.begin(9600);
}
void loop() {
lval = analogRead(Ls);
rval = analogRead(Rs);
if (lval < 250 && rval > 250)
{
digitalWrite(Lm,HIGH);
digitalWrite(Rm,LOW);
}
else if (rval < 250 && lval > 250)
{
digitalWrite(Lm,LOW);
digitalWrite(Rm,HIGH);
}
Serial.println(lval);
}