Arduino controlling resistance, LFO

I want to change my actual “real-life” poti-s to Arduino controlled digital resistors.

Idea1:

I will buy some digital resistors, like the one here: http://www.arduino.cc/en/Tutorial/SPIDigitalPot
I found a guy, who made nice LFO’s (like the example down there) using the PWM output, can i use his code with the SPI interface?

for(counter = 0 ; counter <= 255; counter+=25)
{
  analogWrite(PIN_PWMOUT, counter);
  delay (tempo/10);
}
for (counter = 255; counter >= 0; counter-=25)
{
  analogWrite (PIN_PWMOUT, counter);
  delay (tempo/10);
}

(If i remember well, he reads the tempo value from a poti.)

He made a Sine-wave like LFO, which pulses from 0v to 5v and this way he controlling a vactrol which changing it’s resistance according to the changes in the LFO.

I would use a vactrol, not a digital potmeter if i could buy a vactrol, but they are non-existent in my country. :frowning:

So:
Can i use this code with SPI? (i know i have to change it, but can i get the same sine wave like resistance changes?)

(If there are easier solutions, i would be happy to see them.)

Can i use this code with SPI?

yes why not?

He made a Sine-wave like LFO

This code is not very Sine wave like it's simply a triangle counting up and then down.

I would use a vactrol, not a digital potmeter if i could buy a vactrol, but they are non-existent in my country

So make your own, it's just a light dependent resistor tapped up to an LED.

This code is not very Sine wave like it's simply a triangle counting up and then down.

You are right, he labeled it wrong and i copied the wrong code here.

So make your own, it's just a light dependent resistor tapped up to an LED.

Is there any specific stuff i should go for? Like an extra bright LED? Does the color of the LED matters? And is there any difference between LDRs? Because i could choose from 5 types but they didn't have any technical information, just their price.

(is it possible to buy an LDR which could go from like 0 to 1KOhms to substitute a 1k poti, and an other which could go from 0 to 500KOhms to substitute a 500k poti?) (yeah i know that they can't go down as low as 0ohm, it was just an example)