2010年5月30日日曜日

New Program(original)

This is a program that control LED with more conplex way.
========================================================

int w, r; //define variables
int e=13;

void setup()
{
Serial.begin(9600);
Serial.println("ligth control with variable and increment"); 
w=1;// add a value to the w in this 'void setup' section
}



/*
Basically, this program use increment to control the length of the LED litten.
Increment add +1 to a variable whenever the loop goes and the length(time) of the delay is
decided by the variable.
*/



void loop()
{
w++; // increment(add +1 whenever this loop goes)
digitalWrite(e, HIGH);
delay(r=w*1000); //r is a variable for length and its value is decided by e variable
digitalWrite(e, LOW);
delay(1000);
}

0 件のコメント:

コメントを投稿