Circuit 3 RGB LED and 4 Multiple LED

Circuit 3

Project: Driving an RGB LED; change colors with one LED RGB; use the circuit to create a color combinations

 

2. The code: The code seemed a little intimidating and confusing. I understood that digitalWrite parts of how to turn different pins high and low made different colors. The for() function is what confused me. This time I made sure to select my Arduino board before starting and copied the example code so I would not lose it. I also made a new sketch for just the code and typed it all out.  

I ran the code the first time and got an error.

Compilation error: a function-definition is not allowed here before '{' token



I looked back at the example code to double check it. I was missing a close bracket at the end of the digitalWrite

That fixed the problem!

Completed Code: RGB LED



3. Completed Board



4. Electronic Diagram


5. Video explaining the project and how it works. This is the first video I made: When I first got it working, it was not showing all the colors, so I messed with the wires thinking one was not plugged in. I then messed them up and it only started blinking blue.


I then realized that I had the RGB LED backwards. I turned it the right way and now it shows all the color





6. In video/text thinking.




Challenge Thinking: This week I have a pretty good understanding of how the board works and how all the connections are made and what each wire does. First I put the RGB LED into a4,5,6, and 7. Next I connected the resistors to e- g 4-6. After that I connected the wires from the resistors to digital ports -11.-10 and -9. (I choose wires that coordinated to the colors on the pins of the LED so I would not be confused) This connects to the code const int RED_PIN = 9; const int GREEN_PIN = 10; const int BLUE_PIN = 11; Then I connected a wire from the common ground pin to the negative on the breadboard which connects back to the gnd power port; which gives it power. Last I connected the wires to 5V and positive and GND power to negative on the breadboard. When I first got it working, it was not showing all the colors, so I messed with the wires thinking one was not plugged in. I then messed them up and it only started blinking blue. I then realized that I had the RGB LED backwards. I turned it the right way and now it shows all the colors.

7. Final reflection The first circuit was pretty easy and I was proud of my self for how  quickly I was able to get it done and working. I learned how lights with different colors work and how you can make them fade or go from one to the next using the code. I feel accomplished this week with my first challenge and only a few minor errors. This time I was pretty confident with the wires but was intimidated by the code. I took it one step at a t time wans was extra careful when doing everything making sure I left nothing out. I was able to figure out my errors quickly and fixed it right away. I didn't let it frustrate me or discourage me.



8. possible extensions Circuit 3 real world examples would be lights that change colors or on a computer to show different states of working condition.


Circuit 4

1. Project: Driving Multiple LEDs: connect 8 LEDS and create a light sequence


2. Completed Code link :For this one seemed even more challenging. I took my time again with setting up, which was even harder to see where every piece went on the board. Then I carefully put in the code. I had no errors and all the series worked! I am so proud of my self that I got it right the first time. 

3. Completed Board



4. Electronic Diagram 


5. Video explaining the project and how it works.



6. Video explanation wires: 


 Video explanation code:








Challenge thinking: For this one it seemed even more challenging. I took my time again with setting up, which was even harder to see where every piece went on the board. Then I carefully put in the code. When I went to compile it, I had no errors and all the series worked! I am so proud of my self that I got it right the first time. 

I started with the Gnd power to the positive and the 5v to the negative. Then I put the resistors into a 3,6,9,12,15,18,21, and 24. Then the lights went to c2-3, 5-6, 8-9, 11-12, 14-15, 17-18, 20-21, and 23-24. Last the wires went into p p2 e2, p2 e2, p2 e2, p2 e2, p2 e2, p2 e2, p2 e2, p2 e2, p2 e2, p2 e2, p2 e2

8. Final reflection:

I was hesitant to do this one as I was not sure how hard it would be. It was actually the easiest one to complete. As I mentioned before I took my time hooking up the wires and setting up the code. I again made sure I typed everything out carefully and then on my first try I got everything right. I was so proud of myself and felt like I could do anything when it came to code. It did take me a while to truly understand it, but I eventually did when was explaining it in my video. 

9.Real World Examples: This could be a Marquee as it said in the code but also lights that blink in different ways. 


Week 3 Challenge: 

1. POT to control multiple LEDs
I already had my multiple LEDs hooked up from my last circuit, so I figured I would try to  hook up a potentiometer. I started with adding the pot code to the beginning. I  added the pot code to the beginning int sensorPin = A0; Then I added int sensorValue;
sensorValue = analogRead(A0);delay(sensorValue); int index; int delayTime = (sensorValue); to the oneAfterAnother Loop Then set the delay times to the sensor value after the digitalWrite.
For the Wires I connected the POT to the analog A0. Then the POT to the negative and positive. For the first attempt, it didn't work because I forgot to put in the
 int sensorValue.  After I fixed that it started to work, as seen in the video. 


Video POT to control multiple LEDs



 
Video POT to control multiple LEDs Code Explanation



Challenge 2: Use the POT (potentiometer) to control the brightness of one of the colors of the RGB LED so that you can do some color mixing. 

I started by putting RGB LEDs like it set it up like in the guidebook. Then I put back all the RGB LED wires. At first I wasn't sure how to put the POT on there with the wires with the RGB LED. I also struggled to get my RGB LED hooked back up right, when I first got it in it was blinking only green then only blue so I messed with it a bunch and finally got it in there right.  I then put my POT on the board on the same side as my RGB LED, then connected the it to the A0 analog port and also to the negative and positive on the bread board. For the code I added the Sensor Pin = a0 t the top, then I added the in sensor Value sensorValue= AnalogRead a0 and delay sensor value. to the main colors . At first I added I had to look on the site to find fade code and added delay amount = 0 and changed the delay to 30. On the red led pin  I changed the digital write to analog write  (red pin, sensor Value. Then anytime the red pin was in the code I changed it to sensor Value instead of HIGH or LOW.






Videos Wire Explanation: 


Video Code Explanation: 







Challenge 3:

If you want to try to control all three colors of the RGB LED, think about how you might be able to use one POT, one photoresistor (varies voltage based on how bright the light is), and the thermal sensor (varies voltage based on the temperature being registered).

I started with adding the wires with the photo resistor, connected to a 10K resistor, and wires to A0, positive and negative. Then I added the thermal resistor to A1, and positive and negative. I added the code for the photoresistor ( explained in video) and the code for the thermal resistor (also explained in the video) I was only able to get the red LED to light up and change with the temperature control. I am not sure if I was successful on the photo resistor. 









Videos Wire Explanation:


Video Code Explanation:




Final Reflection Challenges: This week I was pretty intimidated by the challenges. The first one where I controlled the multiple LED's with the POT seemed pretty easy and I got it on the first try. Then I attempted to control the RGBLED with the POT. This one was a little harder as I struggled with the code and board. I couldn't figure out how to control the colors and had to look up on the Arduino website to find code for fading. When I first did it I only did one color and forgot we were supposed to mix the colors by fading a light. I went back and changed how I did the code and was able to mix colors. On the last one is where I really struggled. I tried many different things and places to put the sensor and temp value but was unsuccessful in doing it right. I hate to accept failure but I just couldn't figure it out and spent 2 hours working on it.
Before completing that one, I felt pretty confident in mixing code and creating a new sketch, but that last one got me. I understood how to add code to another code to combine them, but I struggled with figuring out how to adjust the lights. This week was definitely was challenging and although I was not successful in the last one, I still feel accomplished because I figured out the other ones!

Comments

Popular posts from this blog

Challenge Week 5 Photo Resistor