效用:左燈閃3次換右燈閃3次,無限循環
電路接法:
圖形程式方塊:
程式碼:
int _ABVAR_1_a;
int _ABVAR_2_a;
void setup()
{
pinMode( 2 , OUTPUT);
pinMode( 8 , OUTPUT);
digitalWrite(2 , HIGH);
digitalWrite(8 , HIGH);
}
void loop()
{
for (_ABVAR_1_a=1; _ABVAR_1_a<= ( 3 ); ++_ABVAR_1_a )
{
digitalWrite(2 , HIGH);
delay( 500 );
digitalWrite(2 , LOW);
delay( 500 );
digitalWrite(2 , HIGH);
}
for (_ABVAR_2_a=1; _ABVAR_2_a<= ( 3 ); ++_ABVAR_2_a )
{
digitalWrite(8 , HIGH);
delay( 500 );
digitalWrite(8 , LOW);
delay( 500 );
digitalWrite(8 , HIGH);
}
}
沒有留言:
張貼留言