User Tools

Site Tools


workshops:arduino_for_the_curious:stage_4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

workshops:arduino_for_the_curious:stage_4 [2017-04-05 12:52] – external edit 127.0.0.1workshops:arduino_for_the_curious:stage_4 [2017-04-10 11:28] (current) Simon
Line 11: Line 11:
 So our RGB LED is essentially 3 LEDs in one - a red one, a green one and a blue one. By turning on certain combinations of these LEDs we can create lots of different colours. But first... how do we connect them to the Arduino? So our RGB LED is essentially 3 LEDs in one - a red one, a green one and a blue one. By turning on certain combinations of these LEDs we can create lots of different colours. But first... how do we connect them to the Arduino?
  
-RGB LEDs typically have 4 leads. The longest one is the common positive lead shared by each color of LED. The other 3 leads are the 3 negative leads of each of the red, green and blue LEDs inside. Like normal LEDs, RGB LEDs need resistors in series to stop too much current passing through. Again 100-300 ohms is good, and you'll need 3 of them. +RGB LEDs typically have 4 leads. The longest one is the common positive lead shared by each colour of LED. The other 3 leads are the 3 negative leads of each of the red, green and blue LEDs inside. Like normal LEDs, RGB LEDs need resistors in series to stop too much current passing through. Again 100-300 ohms is good, and you'll need 3 of them. 
  
 Connect your RGB LED to your Arduino using the breadboard. Connect your RGB LED to your Arduino using the breadboard.
Line 20: Line 20:
 Since each LED is connected to the Arduino with at its negative lead, the control for this LED is the opposite to the previous LEDs. In order to turn the LEDs on, you need to set the corresponding pins to the LOW (0V) value. Since each LED is connected to the Arduino with at its negative lead, the control for this LED is the opposite to the previous LEDs. In order to turn the LEDs on, you need to set the corresponding pins to the LOW (0V) value.
  
-| {{workshops:challenge_yourself.jpg?200x0}}| **(1)** Write an Arduino program to cycle through the colours red, green and blue.**(2)** Write an Arduino program to cycle through the states red, red+green, green, green+blue, blue, blue+red, red... |+| {{workshops:challenge_yourself.jpg?200x0}}| **(1)** Write an Arduino program to cycle through the colours red, green and blue. \\ **(2)** Write an Arduino program to cycle through the states red, red+green, green, green+blue, blue, blue+red, red... |
  
  
Line 34: Line 34:
 PWM is achieved in Arduino through the analogWrite function. Instead of telling you how to do it though, we thought we'd get you to use the official Arduino documentation. It's useful stuff! PWM is achieved in Arduino through the analogWrite function. Instead of telling you how to do it though, we thought we'd get you to use the official Arduino documentation. It's useful stuff!
  
-| {{workshops:challenge_yourself.jpg?200x0}}| **(1)** Go to the [[http://arduino.cc/en/|Arduino website]] and click on reference. Find analogWrite and use it to fade in and fade out the red LED in the RGB LED.**(2)** Now do the same but with every LED in the RGB LED. You should get a white light fading in and out.**(3)** Now modify that so that each colour component fades in and out at a different rate. This should give you lots and lots of colours. |+| {{workshops:challenge_yourself.jpg?200x0}}| **(1)** Go to the [[http://arduino.cc/en/|Arduino website]] and click on reference. Find ''analogWrite'' and use it to fade in and fade out the red LED in the RGB LED. \\ **(2)** Now do the same but with every LED in the RGB LED. You should get a white light fading in and out. \\ **(3)** Now modify that so that each colour component fades in and out at a different rate. This should give you lots and lots of colours. |
  
  
workshops/arduino_for_the_curious/stage_4.1491396766.txt.gz · Last modified: 2017-04-05 12:52 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki