2022年2月11日 星期五

rain led

 int led_pin[] = {3, 5, 6, 10};

int brightness[7][4] =

{

  {250, 0, 0, 0},

  {100, 250, 0, 0},

  {50, 100, 250, 0},

  {5, 50, 100, 250},

  {0, 5, 50, 100},

  {0, 0, 5, 50},

  {0, 0, 0, 5},

};


void setup()

{


}


void loop()

{

  for (int j = 0; j < 7; j++)

  {

    for (int i = 0; i < 4; i++)

    {

      analogWrite(led_pin[i], brightness[j][i]);

      delay(100);

    }

  }

    for (int j = 0; j < 7; j++)

  {

    for (int i = 0; i < 4; i++)

    {

      analogWrite(led_pin[i],brightness[j][3-i]);

      delay(100);

    }

  }

}

沒有留言:

張貼留言

algorithm

 #include <iostream> #include <string.h> using namespace std; int main(int argc, char** argv)  { for(int j=2;j<=100;j++)//j...