BETTER HOMES
===================================================================================
===================================================================================


Monday, May 22, 2006
--------------------------------------------------------------------------------------------------------------------------------------------------


''minidisco''

light sensors+speakers

elementary code:

sound=sound +direction *(flow)

  3:39 PM
Comments:
int sPin1 = 10;
int sPin2 = 9;
int sPin3 = 11;

int val1a = 0;
int val1b = 0;
int val1c = 0;

int val2 = 0;
int val3 = 0;

long time =0;
long oldtime=0;

int onoff=0;

void setup()
{
pinMode(sPin1, OUTPUT); // sets the digital pin as output
pinMode(sPin2, OUTPUT);
pinMode(sPin3, OUTPUT);
}


void loop()
{
val1a = val1a+1;
val1b = val1b+5;

if(val1a>255)
val1a=0;

if(val1b>255)
val1b=0;

time=millis()-oldtime;
if(time>50)
{
if(onoff==1)
{
onoff=0;
}
else
{
onoff=1;
}

val1b=0;

oldtime=millis();
}

if(onoff==1)
analogWrite(sPin1, val1a) ;

else
analogWrite(sPin1, 0) ;
//analogWrite(sPin1, (val1a+val1b)/2) ;
// analogWrite(sPin1, sin(val1a)*255);
}
//janna e mongo
 
Post a Comment



<< Home
transformations
---------------------------------
info:
+++++++ ______________________________________ konstfacks' transformation/s.20.06.05 ______________________________________
---------------------------------
archives
May 2006 / June 2006 /
---------------------------------
powered by:
Blogger
---------------------------------
Web Site Counter
Free Hit Counter