the idea was inspired from hall automatic lighting
that triggered if someone walking in the hall to light the hall
The components of the project:
Arduino - resistors - microwave sensor - RGB LED - jumper wires - breadboard
first connect the led com cathode to the ground
connect a resistor to each pin of the LED
wire the resistors to PWM pins in arduino
wire Vin to positive - gnd to ground
out to pin 7 in Arduino
wired the LED and sensor to Arduino using the schematic shown in tinkercad
The code works as that :
first if ( read if there is motion in the hall if there light up the LED in sequence RGB with fading effect (count function )
count function is to add the fade effect to the LED (adding 1+ to brightness every cycle
else ( if there is no one in the hall don't light the LED )
copied code text from tinkecad and pasted it into Arduino IDE to compile and uploaded the code to the Arduino
after searching I figured out the problem, it was in the delay the code works so fast that counts fast so the fading isn't noticeable
so adding a small delay to the counter that solved the problem easly
note: delay control fading speed.
another problem the fading wasn't smooth so I edited the code in for loop( i = i ) instead of
(i = constant) so that it prints the last i smoothly
and made a great boxy Steve from Minecraft world