Electronics

This week we were introduced to using Arduino Uno as part of our electronics. We were also given tasks to learn more about how the circuits and programming works using the software itself.

The first task was to write a program such that it would blink the LED in a pattern. For this, we were provided with equipment to use of the following:

  • Arduino Uno
  • Breadboard
  • USB Cable
  • Jumper Wires
  • Resistors
  • LED

After setting up the circuit, I proceed to start doing the coding on the Arduino. The code was taken from the libraries of examples, under the basic, blink.

Then, I customise the coding the ensure that it was the same pin that I had place as seen in the picture above, the pin was place on pin number 8. I also replaced some of the numbers in the duration section to see what would happen if I were to change it.

From this, we can see that the LED will turn on and off in different timings, the first being 500 milliseconds and second being 1000 milliseconds.

The second task assigned was to control the use of LEDs with a button switch. For this we were given the following:

  • Arduino Uno
  • Breadboard
  • USB Cable
  • Jumper Wires
  • 220 ohm and 1 kiloohm Resistors
  • LEDs
  • Button Switch

Again , using TinkerCAD, I set up my cicuit and proceeded with the coding.The cicuit was kept relatively similar, however, having the button placed in and connected to pin 6, along with the 1 kilo ohm resistor to one of the sides of the switch.

From this, we can observe that the initial state is on, however, when the button is being pushed down, the LED will turn off. When it is pushed again, the LED will turn back on.

The third task was to control two different LEDs to flash according to different patterns using the button switch.The is how the setup was done:

Here, we can observe how in the case 0: both LEDs are off. In case 1,the green LED is on while the red LED is off. In case 2, the green LED is off while the red LED is on. In the last case, both LEDs are one. If one were to push in the button again, it will reset back to case 0.