Arduino and 2 MOSFETs I want to turn on 2 bulbs using 2 MOSFETs. The problem is that they both turn on when it should turn up just one light.

Code:

void setup() {
  pinMode(13, OUTPUT);
  pinMode(7, OUTPUT);
}

void loop() {
  digitalWrite(13,1);  
  digitalWrite(13,0);
}


See circuit below:
Try adding a delay into your loop. In your code pin 13 will toggle very rapidly, much too fast to see it. For example:

void loop() {
  digitalWrite(13,HIGH);  
  delay (1000);
  digitalWrite(13,LOW);
  delay (1000);
}




It doesn't look wired correctly. For an N-channel MOSFET the Source should go to ground, like this: