How can I set brightness on my LED?
My led is very strong brightness, like to set the brightness in the code
/*
http://www.arduino.cc/en/Tutorial/Button
*/
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin1 = 1;Â Â // the number of the pushbutton pin
const int buttonPin2 = 2;Â Â // the number of the pushbutton pin
const int buttonPin3 = 3;Â Â // the number of the pushbutton pin
const int buttonPin4 = 4;Â Â // the number of the pushbutton pin
const int ledPin1 = 5;   // the number of the LED pin Starter når arduino starter
const int ledPin2 =Â 6;Â Â Â // the number of the LED pin
const int ledPin3 =Â 7;Â Â Â // the number of the LED pin
const int ledPin4 =Â 8;Â Â Â // the number of the LED pin
const int ledPin5 =Â 9;Â Â Â // the number of the LED pin
// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;Â Â Â Â // will store last time LED was updated
// constants won't change:
const long interval = 1000;Â Â Â Â Â // interval at which to blink (milliseconds)
// Variables will change:
int ledState = LOW;Â Â Â Â Â Â // ledState used to set the LED
#define RELAY1Â 10
#define RELAY2Â 11
#define RELAY3Â 12
#define RELAY4Â 13
// variables will change:
int buttonState1 = 0;Â Â Â Â // variable for reading the pushbutton status
int buttonState2 = 0;Â Â Â Â // variable for reading the pushbutton status
int buttonState3 = 0;Â Â Â Â // variable for reading the pushbutton status
int buttonState4 = 0;Â Â Â Â // variable for reading the pushbutton status
void setup() {
 // initialize the LED pin as an output:
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
 pinMode(ledPin3, OUTPUT);
 pinMode(ledPin4, OUTPUT);
 pinMode(ledPin5, OUTPUT);
 // initialize the pushbutton pin as an input:
 pinMode(buttonPin1, INPUT);
 pinMode(buttonPin2, INPUT);
 pinMode(buttonPin3, INPUT);
 pinMode(buttonPin4, INPUT);
// initialize the relay
 pinMode(RELAY1, OUTPUT);Â
 pinMode(RELAY2, OUTPUT);Â
 pinMode(RELAY3, OUTPUT);Â
 pinMode(RELAY4, OUTPUT);Â
Â
//oppstart PowerOnLed
  digitalWrite(ledPin1, HIGH);
}
void loop()
{
Â
 //blink til led
 // read the state of the pushbutton value:
 buttonState1 = digitalRead(buttonPin1);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState1 == HIGH) {
  // turn blink LED on:
  digitalWrite(ledPin2, HIGH);
  delay(500);
  digitalWrite(ledPin2, LOW);
  delay(500);
 } else {
  // turn blink LED off:
  digitalWrite(ledPin2, LOW);
 }
Â
 //button1
 // read the state of the pushbutton value:
 buttonState1 = digitalRead(buttonPin1);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState1 == HIGH) {
  // turn LED on:
  digitalWrite(RELAY1,0);     // Turns ON Relays 1
 } else {
  // turn LED off:
  digitalWrite(RELAY1,1);     // Turns Relay Off
 }
Â
 //button2
 // read the state of the pushbutton value:
 buttonState2 = digitalRead(buttonPin2);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState2 == HIGH) {
  digitalWrite(RELAY2,0);     // Turns ON Relays 1
  // turn LED on:
  digitalWrite(ledPin3, HIGH);
 } else {
  digitalWrite(RELAY2,1);     // Turns Relay Off
  // turn LED off:
  digitalWrite(ledPin3, LOW);
}
 //button3
 // read the state of the pushbutton value:
 buttonState3 = digitalRead(buttonPin3);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState3 == HIGH) {
  digitalWrite(RELAY3,0);     // Turns ON Relays 1
  // turn LED on:
  digitalWrite(ledPin4, HIGH);
 } else {
  digitalWrite(RELAY3,1);     // Turns Relay Off
  // turn LED off:
  digitalWrite(ledPin4, LOW);
}
 Â
Â
 //button4
 // read the state of the pushbutton value:
 buttonState4 = digitalRead(buttonPin4);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState4 == HIGH) {
  digitalWrite(RELAY4,0);     // Turns ON Relays 1
  // turn LED on:
  digitalWrite(ledPin5, HIGH);
 } else {
  digitalWrite(RELAY4,1);     // Turns Relay Off
  // turn LED off:
  digitalWrite(ledPin5, LOW);
 }
}