controlling a super-bright led 3,5 watt

do you think this may work?

    // Esempio 01: accendi il led appena è premuto il pulsante  
      
    #define LED 7                // LED connected to the digital pin 7  
    #define BUTTON 9              // pin input button  
    int  val = 0;                 // status input   pin
      
    void setup() {  
      pinMode(LED, OUTPUT);       //  pin as output  
      pinMode(BUTTON, INPUT);     // pin as input  
    }  
      
    void loop() {  
      val = digitalRead(BUTTON);  // read the pin value and save it
      
      // control that input is HIGH (button pressed)  
      if (val == HIGH) {  
        digitalWrite(LED, HIGH);  // led  turn on
      }  
      else {  
        digitalWrite(LED, LOW);   // led  turn off
      }  
    }

If you want to start a fire, then yes.

A few observations:

  • The 2N2222 is not good for 1A
  • Why is there a 10k resistor in the current return path
  • If the LED gets warm (and it will), it's forward voltage will go down --> more current --> gets even warmer ... etc

Constant current LED drivers are the way to go. Either get one on ebay for almost no money or build one (most likely more expensive).

madworm: * The 2N2222 is not good for 1A

um.. you are right this is the specs of the 2N2222T i bought:

Manufacturer Part No: 2N2222A ROHS: Yes Current Rating: 0.8A Voltage Rated: 40V Transistor Type: NPN Features: General Purpose Package: TO-92

so if i use a resistor that limit the ampere to 0,7A it should be fine.. (altought i will lose a bit of light), or i may just use another transistor model that support 1A (as the 2SC1384)

  • Why is there a 10k resistor in the current return path

i corrected the resistors position

  • If the LED gets warm (and it will), it's forward voltage will go down --> more current --> gets even warmer ... etc

the LED will not be permanently ON, it will be installed on a replica gun to simulate the fire of the shot

i also changed the power supply of the led, now i connected it directly to the arduino 5volt

You are running a 3.5W LED through a 2W resistor? I suppose that would be OK for short bursts.