Hello, I have not done anything, I got stuck at the very start of the loop... If I put it like this:
const int green = 5;
const int red = 6;
const int blue = 3;
const int button = 2;
int buttonState = 0;
int val = 0;
int analogPin = 3;
void setup() {
// put your setup code here, to run once:
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(button, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
val = analogRead(analogPin);
buttonState = digitalRead(button);
if (buttonState == HIGH){
analogWrite(green, val / 4);
}
}
it will only change brightess of green led when button is pressed... And yes i have led, not sensor ![]()
thank