A picture of me working on the Arduino circuit.
https://drive.google.com/file/d/1DeK9dEwEncAd_Bs2hqIxvPf8ncZL18FI/view
^^^^^ A link to all of the construction of the Arduino Circuits.
Circuit One, Blinking an LED
A model of Circuit 1
This schematic, is an average symbol visual of how an LED will light up. the schematic shows how electricity, (volts) travel through the Arduino board. This specific one shows how an LED is lit up as the code allows electricity to travel through pin 13 to the LED light(lighting it up) to the resistor, to the ground, this is how the majority of LED (light up) circuits work.
(Pin 13 is specific to to this circuit but it could connect to any of the Pins(2-13), but it is mandatory to have it connected to one of the pins, otherwise you will not be able to call it in your code.)
Circuit one
Circuit 1 code
The original pre-written-USK-code of circuit one. Which enables the Arduino board to understand commands and turn on / off an LED light every second
Process
Circuit one, (manipulated).
Changed code of Circuit 1.
We have changed the code in one way; increasing the rate of the LED so that you can "barley see it blinking".
you can see the change when you look at line 7 and 11, with "delays(50)", it used to be "delay(1000)". The process "delay" is exactly what is sounds like, it delays the following action. the difference between the 2 is that in the first code they delay time is 1 second. where in our now changed code the delay time is 1/20th of a second.
Circuit Two, Potentiometer
Circuit 2 model
Circuit 2
The code of Circuit 2
The code enables for a potentiometer to be declared as a variable that can change, connecting it to analog Pin 0-Its an analog input pin that can be used to read voltage levels that range from 0 volts to the supply voltage of the board-which is nifty because the potentiometer is a variable resistor that can change how electricity is released, and in this specific circuit, the rate of the LED blinking.
Process
A visual of a potentiometer
The potentiometer.
A potentiometer is a type of variable resister. Turning the potentiometer changes the electrical signal, and hence, (dependent on the code), can change the rate of the blinking LED.
Circuit 3, RGB LED
In this circuit we are using a 4 prong RGB LED to show a variety of colors on the LED this is done by turning on multiple of the prongs at the same time, for example, the are already our main colors, RED, GREEN, and, BLUE, but to make purple you would turn on the blue, and red LED components.
A video for circuit 3
A model for circuit 3
Most important part of the code displaying the main colors
Process
Code of show spectrum
Circuit 4, Dancing Lights.
A model of the components for Circuit 4
Notice that in the model for circuit 4, every single LED has a jumper(wire) next to it that connects to one of the Pins. This is a perfect example of how in every LED schematic, the LED has to be connected to one of the Pins to be able to call it in the code. Along with its resistor as every LED has its own resistor.
A showcase of how the code makes the lights "dance".
Unchaged code of circuit 4
How this code works is that essentially our 'index" represents all of our LED Pins(the amount of led Pins not the actual number of the Pin) so when "index" is less then or equal to 7, we will add 1 number to the index so instead of working with index 1, it will now work with index . after all of this is true Our LED will light up and then continue to light up the other LEDs until it is no longer true, (index is no longer less then or equal to 7). after this it will start to do the same thing but in reverse, due to their then being a "for loop" saying that if the index is equal to 7, then the code will start subtracting 1 from the index.
Process
One-After-the-Other Arduino product
<, One-After-the-Other LED Arduino. How this code works is that essentially our 'index" represents all of our LED Pins(the amount of led Pins not the actual number of the Pin) so when "index" is less then or equal to 7, we will add 1 number to the index so instead of working with index 1, it will now work with index 2 . after all of this is true Our LED will light up and then turn off. and it will continue down the line until it is no longer true, (index is no longer less then or equal to 7). In which case it will start form the beginning.
RandomLED function product
One-After-the-Other Arduino code.
RandomLED circuit works in the same way except for> its loop function. Again our 'index" represents all of our LED Pins. But instead of our index needing to be less then or equal to 7 to procced, our index will now be randomly chosen, which means a random LED will turn on and off. Since it is a loop, it will continue turning on and off random LEDs.
RandomLED code
Circuit 5, Pushbutton
A showcase of circuit 5.
The code for the pushbuttons.
Circuit 5, in which when pressing button, it allows the LED to light up. it follows the code with 'if statements", that state "if the button 1 or button 2 are being pressed, our LED will turn on. but if we are pushing down button 1 and 2 our LED will not run on. And then if neither of these things are true, regardless, our LED will not turn on.
Circuit 6, Photoresisstor
A model of Circuit 6
In this circuit we use a new component, a photoresistor, which is basic terms is a light sensor, which can be used to detect light. And in real-world use can be used to make stuff like night-lights.
Demonstrating a photoresistor on "night light mode".
Unchaged code of Cirucit 6
The already existing code uses a photoresistor, which is light sensor to command how bright the LED will flash. right now with its settings the LED will flash brighter when there is "no light present" but its not very obvious due to the fact that the LED still shines even when their is light. Essentially this is not good because if we were to look at it from a real world application, this circuit would work like a night light, and a nightlight that still emits light when light is present it in the room, is not a good "night light" and would waste energy.
Process
Both of these function and different code work for the same thing. An effective nightlight, only lighting up the LED when no light is present. The only difference between these two, is that the code that was changed has to do with the ranges of the LED brightness, the function Auto-tune does all the work for us, essentially we just had to enable the Auto-tune function. But with Manuel-tune, we had to individually test out a lot of different rages for our night light to be effective, essentially manually changing the ranges ourselves so the LED can be completely off when light is present.
Auto-tune
<Some of the pros to the Auto-tune function was that we didn't have to waste time trying to find the ranges, in other words, it was the easiest to work out.
But due to the fact that we essentially had to do no work, we didn't understand what was really happening .
Manuel-tune
the code for Auto-tune
Some of the pros to the Manuel-tune function was that because we did so much trial and error with this function, we got a good understanding of how the ranges in something like LED brightness work, and therefore we can now apply this knowledge to different works that we may do in the future
Some of the cons was that it took us a very long time trying everything out.
the code for Manuel-tune
Circuit 7, Tempature sensor
A visual of the components of the circuit.
The unchanged code of circuit 7
In this circuit we are using a temperature sensor, which measures the ambient temperature. We are integrating this device into our Arduino circuit with the objective of making the ambient temperature equal to the amount of volts our Arduino will output. If we look at our serial monitor we can see that the temperature changes, that is because we are exposing the temperature sensor to our body heat by touching it, by doing this we we can fully see the extent of how our code applies itself.
The serial monitor, that demonstrates how the code makes the amount of voltage our circuit is output-ing equal to the ambient temperature. ( To a degree as our Arduino board can only have an output of 5 volts or else it would risk damage to the board.)
Process
Using the same basis, this time we have created a circuit that uses the temperature sensor to make the ambient temperature equal to the amount of volts our Arduino will output, and make it so an LED will turn on if the ambient temperature is over a certain degree.
A showcase of how our changed circuit, and its output.
Its not very apparent in our video but we did change some of the layout and components of our Arduino circuit board to make the function of our LED possible. We have added a 330 resistor, an LED and 1 extra jumper wire. As we stated in circuit 1, to make an LED light up you need a schematic of a wire connecting-to an output Pin-to your LED-to a resistor and then finally to the ground, this schematic allows electricity to flow and turn on the LED.
It is absolutely necessary to connect the output Pin, in this instance Pin 13, to the LED. This is because otherwise we would not be able to call our LED(in the code its expressed as "13") in our code, essentially rendering the LED useless.
Our changed code to accommodate for an LED turning on if the temperature is over 84 degrees Fahrenheit.
We have added 2 things to our code. The first modification was stating the existence of our LED, expressed as "13" from Pin 13 on our Arduino board. Calling "13 "equates to calling our LED, this is because Pin 13 enables electricity to flow through the circuit so if we call "13" to be "HIGH" we are essentially commanding Pin 13 to output electricity, which will turn on our LED.
Our second modification was adding an "if-statement". We used the variable "degreesF" to state that "if the ambient temperature in Fahrenheit is over 78 degrees, our LED will turn on". but with if-statements we also have to state the contrary- with "else", in which case we coded it so "if the ambient temperature in Fahrenheit is not over 75 degrees, our LED will not turn on".
We used the variable of "degreesF" but we could have also used "voltage" or "degreeC", they are interchangeable because of the past code stating they are equal (to a degree), but of course you would have to also change the measurement.