the code and the actual output didn't match
You wrote:


  when i simulate it on proteus, it seems not the same as i mean


The attached picture is not very clear, but it seems to me that it's
doing exactly what you asked for: a PWM output that switches between two
different output pins. The program should work as expected, with only a
few caveats. Let me comment it in some detail:



ICR1 = 100000;


Here you are setting ICR1 to 34464 (i.e. 100000 modulo
216). This is likely not what you mean...

Serial.begin(115200);


There is no point in initializing the serial interface if you are not
going to use it.

for (z = 0; z &lt;= hasil; z++)
    reado = map(hasil, 0, 255, 0, ICR1);


There is no point in calculating many times the exact same value.
Actually, there is no point in calculating it even a single time, since
you are not using the result anywhere in your program.

analogWrite(9, hasil);


Here you are setting the duty cycle to some number between 31 and 1023.
Given that the top value of the timer is 34464, the actual duty cycle
will always be less than 3%. This is the reason why it looks like a
series of narrow spikes on the virtual scope.

But maybe what you really meant is

reado = map(hasil, 0, 1023, 0, ICR1); // note: 1023, not 255
analogWrite(9, reado);


I would not recommend using analogWrite() with a non-standard top
counter value. There is a special case handled in analogWrite() where,
if the argument happens to be 255, you get instead a
digitalWrite(pin, HIGH). This is most likely not what you want. Now
that you started controlling the timer with raw IO access, you should
continue this way.

else if (hasil &lt; 30)


Did you consider what the program should do if hasil happens to be
exactly 30? None of the if/else cases would then match. You probably
meant

else if (hasil &lt;= 30)


but, as suggested by user11249082's answer, a plain else is the best
way to ensure you did cover all possible cases.