<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Maple_Lesson_07_-_Control_RGB_LED</id>
		<title>Maple Lesson 07 - Control RGB LED - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Maple_Lesson_07_-_Control_RGB_LED"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Maple_Lesson_07_-_Control_RGB_LED&amp;action=history"/>
		<updated>2026-04-30T03:46:15Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Maple_Lesson_07_-_Control_RGB_LED&amp;diff=3933&amp;oldid=prev</id>
		<title>Jasonsheng：Created page with &quot;{| style=&quot;width: 800px;&quot; |- | ==Objective== You have learned several LED experiment, then go on studying the RGB LED that is display different color by a RGB LED, including th...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Maple_Lesson_07_-_Control_RGB_LED&amp;diff=3933&amp;oldid=prev"/>
				<updated>2014-08-24T13:16:11Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== You have learned several LED experiment, then go on studying the RGB LED that is display different color by a RGB LED, including th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
You have learned several LED experiment, then go on studying the RGB LED that is display different color by a RGB LED, including the breathing lamp's effect.&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*[[ Microduino-CoreSTM32]]&lt;br /&gt;
Microduino-CoreSTM32 is an ARM development board using STM32F103CBT6 chip. It use special Upin7 interface, the size is similar with a coin and fully compatible other Microduino modules.&lt;br /&gt;
&lt;br /&gt;
*Other hardware equipment&lt;br /&gt;
**Breadboard Jumper            one box   &lt;br /&gt;
**Breadboard  	               one piece  &lt;br /&gt;
**RGB LED                      one &lt;br /&gt;
**220Ω resistor 	             one &lt;br /&gt;
**USB Data cable               one&lt;br /&gt;
&lt;br /&gt;
[[File:STM32-lesson7All.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===RGB===&lt;br /&gt;
RGB LED contains three LEDs, one is red, the other is green and another it blue. &lt;br /&gt;
By controlling three LED's brightness, you can mix up almost any color you want.&lt;br /&gt;
[[File:lesson7-RGB.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
===Connection method===&lt;br /&gt;
*Method 1: The longest lead wire (anode) will be connected to +5 V. The other three pins are connected the series resistance of 220Ω then connected to Microduino PWM output port. The resistance use to prevent too much current flows and burn the LED.&lt;br /&gt;
*Method 2: RGB anode through 220Ω resistor connects to VCC, the other three pins connected to the PWM output port. Three LED share a resistance, then the brightness dimmed.&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
The following connection uses method 1 and uses pin D4、D11 and D12. You also can use PWM pin：0,1,4,11,12,14(A0),15(A1),16(A2),17(A3),18(SDA),19(SCL),20(A6),21(A7).&lt;br /&gt;
[[File:stm32-lesson7-schematic.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
int redPin = 4;&lt;br /&gt;
int greenPin = 11;&lt;br /&gt;
int bluePin = 12;&lt;br /&gt;
 &lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  pinMode(redPin, PWM);&lt;br /&gt;
  pinMode(greenPin, PWM);&lt;br /&gt;
  pinMode(bluePin, PWM);  &lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
  setColor(65535, 0, 0);  // Red&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  setColor(0, 65535, 0);  // Green&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  setColor(0, 0, 65535);  // Blue&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  setColor(65535, 65535, 0);  // Yellow&lt;br /&gt;
  delay(1000);  &lt;br /&gt;
  setColor(80, 0, 80);  // Purple&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  setColor(65535, 65535, 65535);//White &lt;br /&gt;
  delay(1000);&lt;br /&gt;
  setColor(0, 0, 0);  //Black&lt;br /&gt;
  delay(1000);&lt;br /&gt;
  for(int i=0;i&amp;lt;65535;i+=1285)//Red coming on&lt;br /&gt;
  {&lt;br /&gt;
    setColor(i, 0, 0);  &lt;br /&gt;
    delay(30);&lt;br /&gt;
  }&lt;br /&gt;
  delay(100);&lt;br /&gt;
  for(int i=65535;i&amp;gt;0;i-=1285)//Red coming off&lt;br /&gt;
  {&lt;br /&gt;
    setColor(i, 0, 0);  &lt;br /&gt;
    delay(30);&lt;br /&gt;
  }&lt;br /&gt;
  delay(100);&lt;br /&gt;
  for(int i=0;i&amp;lt;65535;i+=1285)//Blue coming on&lt;br /&gt;
  {&lt;br /&gt;
    setColor(0, i, 0); &lt;br /&gt;
    delay(30); &lt;br /&gt;
  }&lt;br /&gt;
  delay(100);&lt;br /&gt;
  for(int i=65535;i&amp;gt;0;i-=1285)//Blue coming off&lt;br /&gt;
  {&lt;br /&gt;
    setColor(0, i, 0);  &lt;br /&gt;
    delay(30);&lt;br /&gt;
  }&lt;br /&gt;
  delay(100);&lt;br /&gt;
  for(int i=0;i&amp;lt;65535;i+=1285)//Green coming on&lt;br /&gt;
  {&lt;br /&gt;
    setColor(0, 0, i);  &lt;br /&gt;
    delay(30);  &lt;br /&gt;
  }&lt;br /&gt;
  delay(100);&lt;br /&gt;
  for(int i=65535;i&amp;gt;0;i-=1285)//Green coming off&lt;br /&gt;
  {&lt;br /&gt;
    setColor(0, 0, i);  &lt;br /&gt;
    delay(30);&lt;br /&gt;
  }&lt;br /&gt;
  delay(100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void setColor(int red, int green, int blue)//Color display program&lt;br /&gt;
{&lt;br /&gt;
  pwmWrite(redPin, 65535-red); //A total of anode RGB, low level light red LED using 65535-red&lt;br /&gt;
  pwmWrite(greenPin, 65535-green);&lt;br /&gt;
  pwmWrite(bluePin, 65535-blue);  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
In a light can be seen on red, green, blue, yellow, purple, black, white, and the effect like a breathing lamp.&lt;br /&gt;
&lt;br /&gt;
[[File:stm32-lesson7Result.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jasonsheng</name></author>	</entry>

	</feed>