creative

Counter UP program(Arduino)

아빠 2018.07.23 09:54 조회 수 : 13502

20180720_134846.jpg

int counter_complete = 0;

 

void setup()

 

{

  Serial.begin(9600);

  pinMode(8, OUTPUT);

}

 

void loop()

{

  if (counter_complete == 0){

    Serial.println("Input Counter Number?");

    while (Serial.available() == 0); // wait input

    unsigned long counter_number = Serial.parseInt(); //read int or parseFloat for ..float...

    Serial.print("Value of Counter:");

    Serial.print(Counter_number);

    Serial.println("Running");

    //Looping Counter to 0000000 7digit.

    while(counter_number < 10000000){

      // Serial.println(counter_number);

      digitalWrite(8, HIGH);

      delay(18);

      digitalWrite(8, LOW);

      delay(18);

      counter_number++;

    }

    Serial.println("Done.");

  counter_complete = 1;

  }

}

menu