Circuit n.1
I want to make a circuit with switch to control the RGB LED 2 colors (red, blue) while it's on or off.
first, I connected the input and outputs on Arduino:
the (common pin) of the switch on digital pin 4
the (terminal 1,2) on the GND, 5V
the RGB (cathode pin) on GND.
Blue color on pin 3, Red color on pin 2 and each color is connected to a 220-ohm resistor.
For Arduino Code
first of all, as the first time to write that simple code i tried it with tinker blocks to how the circuit would work
then, i saw it on tinkercad as a code (block+ text) to see it as text before writing it on IDE
at last, i wrote it with Arduino without any copy pest
لو فاكره اشتغل من غير bug تبقى غلطان
i had a bug:
at loop we write the text between "{}", at 7 line i opened it with "{" so, it's expected to finish it with "}" at the end (after else at line 15) but i forgot
and for if condition, it should end with "}" before else but i make it "{" which is wrong
ارجو التركيز يا اوستاذة مريم بعد كده في ; و {} و"و'