int LEDpin = 13; double brightness = .5; int ratio = int(1/brightness); void setup() { Serial.begin(9600); Serial.println(ratio); } void loop() { pinMode(LEDpin, OUTPUT); int count = 1; for(count; count <= ratio; count++){ if(count == ratio){ digitalWrite(LEDpin, HIGH); delay(5); Serial.println("on"); } else{ digitalWrite (LEDpin, LOW); Serial.println("off"); delay(5); } Serial.println(count); } }
No comments:
Post a Comment