Controlling DC motor (transistor problems solved *Use MOSFETs*

CrossRoads:
http://www.irf.com/product-info/datasheets/data/irfz44v.pdf

Well, may be better. Hard to say as Rds is not spec'ed with Vgs at 5V, only for 10V.
Figures 1,2,3 would seem to indicate that Vgs of 5V would allow up to 11A.

hey crossroads since our online can you tell me how I can subtract an analog value? Basically one of my sensors gives off about 98 out of 255 and the other shows 110 in the same lighting condition. I want them to be the same so the motor speed is the same when the LDR's are the same.

Here's my code so far. (yes it needs some cleaning

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
int Lm = 5;
int Rm = 3;
int lval = 0;
int rval = 0;
int Ls = 4;
int Rs = 5;
int lval2;
int rval2;
void setup() {                

  pinMode(Lm, OUTPUT);     
  pinMode(Rm, OUTPUT);   
 Serial.begin(9600); 
}

void loop() {
  
  lval = analogRead(Ls);
rval = analogRead(Rs);
 
 lval2 = map(lval, 0, 1023, 0, 255);
 rval2 = map(rval, 0, 1023, 0, 255);

 
 analogWrite(Rm,rval2);
analogWrite(Lm,lval2); 
  

  
  
  


  Serial.println(rval2);

  
  
  
  
}

just simple math once you have read it in:

lval = analog Read(Ls);
lval = lval-(110-98);

CrossRoads:
just simple math once you have read it in:

lval = analog Read(Ls);
lval = lval-(110-98);

ohok yeah I new you had to subtract the difference but I didn't know how. thanks!