24th Jan 2021 – Tolu

In the beginning of the lab session we were reminding ourselves of the previous lab and the things we did.

The first task of this weeks lab was to build a circuit that would cause a push button to control a LED using the bread board, Arduino software, switch and resistor. I firstly began by putting all the components in the right place on the breadboard then making sure that my circuit board also had the correct components in the correct place. After doing all this the next step is to put the code into the Arduino software. Making sure that everything is clear and there are no errors. Verify the code and upload the code and check using the switch if the LED is being controlled when you press it. Good for me it worked.

The next task was to use the code that would cause the LED to remain on after the button had been pressed. The code does not really change however it just gives the instruction to Arduino to “store” the value of the integer that keeps the LED on. This is important because without the store function, the LED would not be able to stay on. 0 = LED off and 1 = LED on. The state variable was determining whether the LED was on or off. The end result was that the button worked for me.

Next I used an improved code because there were times that the button was pressed and it wouldn’t register meaning the LED would either not turn on or turn off. The reason for this is because there’s bouncing from the two pieces of metal inside the button. The bouncing is only for a very small distance and happens for a short time, it causes the switch to change between off and on a number of times until the bouncing stops, and Arduino is quick enough to catch this. The outcome still worked for me at times but not consistently so I went ahead to use a code that would help with the bouncing.

The next code was more improved. It wanted to use the change of state (on and off) and keep them so that it was consistent. The main thing in this code was the if state (high and low). This is a point where the code is remembering the previous function. For example if the switch is off, when you press it the LED comes on. Even though it has changed from on to off it remembers the previous state of the LED being off so that when the button is eventually pressed again, the previous remembered function will be applied (The LED turns off).

The next task was Controlling the LED with PWM. Our task was to take advantage of the effect of Persistence of Vision (POV). In the code, by changing delay times if i made the on delay different from the off delay, yI would make the LED brighter by leaving it on for longer, and the LED dimmer by leaving it off or longer. The technique being used here is called pulse-width modulation aka PWM. This is because there is a change in the LED’s brightness by changing the width of the pulse. My end product produced an LED that was dimming and relighting.

17th January 2021

In the beginning of the session, students that took part in a previous module demonstrated their models that were created. It was cool to see how light could affect sound.

The first thing we did in the lab was to look at the Arduino board. Looking at the different part of the board and identifying specific parts of them making sure that we know where things would be placed.

We began coding using the software Arduino. the first task was to implement the coding that would cause the LED to flash. Making sure that each step was followed I was able to complete this and get the correct outcome.

The next task using Arduino was to experiment with the delay time of the LEDs changing them in the software just to see how a smaller delay time would affect and how a higher delay time would affect the rate at which the LED flashed.

Next we looked at using a function to loop 2 chosen letters for me which were L & H. when performed correctly using the correct format the end product would be automatic looping of L and H as such … LHLHLHLHLH etc. We did this by set up a function that would enable a loop when we were to go into the serial monitor. Making sure that all instructions and functions were written accurately and carefully spaced out, I was able to achieve the final goal.

The final task we did was to substitute our old functions for a new and simple one to get the same end goal of the blinking LED. This was done by first of all naming our function and then pasting it in place of the the long function that was used in the first task. This task was well performed as I had a good outcome with the blinking LED.