Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- תוכנית בדיקה לחיבור נורת לד כולל שינוי בהירות
- */
- void setup() {
- Serial.begin(9600);
- }
- void loop() {
- Serial.println("Test LED:");
- Serial.println("=========");
- Serial.print("Enter the pin number that the LED is connected to:");
- while (Serial.available() == 0);
- int ledPin = Serial.parseInt();
- Serial.println(ledPin);
- pinMode(ledPin, OUTPUT);
- Serial.println("Test LED Blink - 5 blinks, interval 1 second");
- for (int i = 0; i < 5; i++) {
- digitalWrite(ledPin, HIGH);
- delay(1000);
- digitalWrite(ledPin, LOW);
- delay(1000);
- }
- Serial.println("Test blink END");
- delay(2000);
- if (ledPin == 3 || ledPin == 5 || ledPin == 6 || ledPin == 9 || ledPin == 10 || ledPin == 11) {
- Serial.println("Test LED brightness");
- for (int j = 0; j < 256; j += 5) {
- analogWrite(ledPin, j);
- delay(30);
- }
- for (int j = 255; j >= 0; j -= 5) {
- analogWrite(ledPin, j);
- delay(30);
- }
- }
- Serial.println("**********************************************");
- Serial.println("Test ended");
- Serial.println("If no blinks where viewed test you LED connections");
- Serial.println("If no change in brightness was seen, verify the the LED is connected to the correct pin,");
- Serial.println("have the right resistor size, not burnt");
- Serial.println();
- Serial.println();
- Serial.println();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement