「ホタログ16」の編集履歴(バックアップ)一覧はこちら
「ホタログ16」(2008/02/16 (土) 02:29:52) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
**2008.2.16
-&bold(){評価実験~}
久々の更新は,実験用プログラムメモ.
後日,実験については説明するかも...
#highlight(c){{
/* Blinking LED -> firefly 実験用
* ------------
*/
int ledPin = 11; // LED connected to digital pin 13
int wait1;
int wait2;
int n = 1; // Loop counter
int t = 0; // Time Loop counter
int value = LOW;
int pluss = 1;
int length;
// Program variables
int ledVal = 255;
// Variables to store the values to send to the pins
int ad; // Analog Input
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
Serial.begin(9600);
}
void loop()
{
length=8;
if( t >= 0 && t < length){
wait1 = 10;
wait2 = 0;
}else if(t>=length && t<length*9){
wait1 = 1;
wait2 = (int)(t/length)+1;
}else if( t >= length*9 && t < length*10 ){
wait1 = 0;
wait2 = 10;
}
if( t == 0 ){
pluss = 1;
}else if( t == length*10 ){
pluss = 0;
}
/* 実際は変わったけどこんな感じ.
// bright
wait1 = 10;
wait2 = 1 ;
// dark
wait1 = 10;
wait2 = 10;
// zero
wait1 = 1 ;
wait2 = 10;
*/
// about 方向
if( pluss == 1 ){ // 正方向
t++;
}
else if( pluss == 0 ){ // 逆方向
t--;
}
value = HIGH;
digitalWrite(ledPin, value);
delay(wait2);
value = LOW;
digitalWrite(ledPin, value);
delay(wait1);
ad = analogRead(0);
Serial.print(t);
Serial.print("\t");
Serial.println(ad);
}
}}
>&bold(){コメント}
#comment(vsize=2,nsize=20,size=40)
----
----
today: &counter(today)
yesterday: &counter(yesterday)