プログラムです。
--------------------------------
long randNumber;
int a;
int b;
int c;
int d;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
// pinMode(8,OUTPUT);
// pinMode(1,OUTPUT);
randomSeed(analogRead(0));
}
void loop() {
randNumber = random(10, 20);
b = randNumber;
for(int i = 0; i<=b;i++){
randNumber = random(3, 8);
a = randNumber;
digitalWrite(a,HIGH);
delay(100);
digitalWrite(a,LOW);
delay(100);
}
digitalWrite(5,HIGH);
delay(3000);
digitalWrite(5,LOW);
randNumber = random(1, 3);
c = randNumber;
if ( c == 1 ){
digitalWrite(6,HIGH);
delay(1000);
digitalWrite(6,LOW);
delay(1000);
randNumber = random(1, 3);
d = randNumber;
if ( d == 1 ){
digitalWrite(7,HIGH);
delay(3000);
digitalWrite(7,LOW);
delay(1000);
}else
{
digitalWrite(5,HIGH);
delay(3000);
digitalWrite(5,LOW);
delay(1000);
}
}else
{
digitalWrite(4,HIGH);
delay(1000);
digitalWrite(4,LOW);
delay(1000);
randNumber = random(1, 3);
d = randNumber;
if ( d == 1 ){
digitalWrite(3,HIGH);
delay(3000);
digitalWrite(3,LOW);
delay(1000);
}else
{
digitalWrite(5,HIGH);
delay(3000);
digitalWrite(5,LOW);
delay(1000);
}
}
}
----------------------------------------
0 件のコメント:
コメントを投稿