Hello, is this a support request for a Wayne and Layne product?
What do you mean by “it didn’t work out”? Providing details about what you expect, and what you actually observe, really help make it easier for other people to help.
Since you didn’t say what you wanted to do, I can guess from your code that you want the LED to fade between off and on. The problem is that each time through the loop() brightness is exactly the same, it is never updated. Try this code instead. I have removed the levelOfBrightness variable and instead just use the brightness variable. Each time through loop we add fadeAmount to brightness, and use that with analogWrite(). If the brightness value is at 0 or 255, we negate the fadeAmount variable. Hope that makes sense.
int LED = 5;
int brightness = 0;
int fadeAmount = 5;
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
brightness = brightness + fadeAmount;
analogWrite(LED, brightness);
if ((brightness == 0) || (brightness == 255)) {
fadeAmount = -fadeAmount;
}
delay(30);
}