Controlling light intensity with solid state relay

Hey everyone, I´m new at arduino stuff and I'm trying to control light intensity in a led light bulb using a solid state relay.

In the code shown below, I manage to control light intensity, HOWEVER, as I try to controll it, LED starts to blink and I haven´t managed to make it stop. I already tried changing the delays. I´d really appreciate any help.

const byte pin=3;
int t1,per;
byte i=0;

void setup() {

pinMode(pin,OUTPUT);
}

void loop() {

for (int pw=0; pw<=100; pw=pw+10){
per=5; t1=pw*per/100;
for (int k=0; k<100; k++){

digitalWrite(pin,HIGH);
delay(t1);
digitalWrite(pin,LOW);
delay(per-t1);
}

}
}

not too sure why you coded it the way you did but...

why not just use analogWrite() to control you SS relay and light intensity?

I already tried it like that, and the light still blinks

int i;

void setup() {
  pinMode(3,OUTPUT);

}

void loop() {
 for ( int i=0; i<=255; i++){

  analogWrite(3,i);
  delay (10);
}

for (int i=255; i>=0; i--){

  analogWrite(3,i);
  delay(10);
}


delay (2000);
}

You identified your LED light as a light bulb and are controlling with a SSR, which means you are using an AC powered LED bulb that has electronics in it to convert from AC to the DC required by the LED chip. The LED bulb takes a bit of time to power up the electronics in the bulb. This is what you are fighting.

Paul