<?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=RGB_light</id>
		<title>RGB light - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=RGB_light"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=RGB_light&amp;action=history"/>
		<updated>2026-04-30T04:00:27Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=RGB_light&amp;diff=2707&amp;oldid=prev</id>
		<title>Pkj：Created page with &quot;{{Language | rgb灯}} {| style=&quot;width: 800px;&quot; |- | ==Objective== This tutorial will teach you using the Processing to control RGB LED, then use a color selector to control th...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=RGB_light&amp;diff=2707&amp;oldid=prev"/>
				<updated>2014-05-16T01:18:43Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language | rgb灯}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== This tutorial will teach you using the Processing to control RGB LED, then use a color selector to control th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language | rgb灯}}&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
This tutorial will teach you using the Processing to control RGB LED, then use a color selector to control the color.&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*'''[[Microduino-Core]]'''&lt;br /&gt;
*'''[[Microduino-FT232R]]'''&lt;br /&gt;
*Other equipment&lt;br /&gt;
**USB cable           one  &lt;br /&gt;
**RGB LED             one&lt;br /&gt;
**330Ω resistor       one&lt;br /&gt;
**Bread               one&lt;br /&gt;
**Breadboard Jumper   onebox&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
&lt;br /&gt;
[[File:processingControlRGBLEDSchematics.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
&lt;br /&gt;
https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Processing/RGBLED&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
&lt;br /&gt;
Step 1：Set up hardware system, as follows:&lt;br /&gt;
[[File:processingControlRGBLEDConnectionDiagram.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 2：Explain the code:&lt;br /&gt;
&lt;br /&gt;
//Display palette function&lt;br /&gt;
  void drawShadeWheel() {&lt;br /&gt;
    for (int j = 0; j &amp;lt; steps; j++) {&lt;br /&gt;
      color[] cols = { &lt;br /&gt;
        color(255-(255/steps)*j, 255-(255/steps)*j, 0), &lt;br /&gt;
        color(255-(255/steps)*j, (255/1.5)-((255/1.5)/steps)*j, 0), &lt;br /&gt;
        color(255-(255/steps)*j, (255/2)-((255/2)/steps)*j, 0), &lt;br /&gt;
        color(255-(255/steps)*j, (255/2.5)-((255/2.5)/steps)*j, 0), &lt;br /&gt;
        color(255-(255/steps)*j, 0, 0), &lt;br /&gt;
        color(255-(255/steps)*j, 0, (255/2)-((255/2)/steps)*j), &lt;br /&gt;
        color(255-(255/steps)*j, 0, 255-(255/steps)*j), &lt;br /&gt;
        color((255/2)-((255/2)/steps)*j, 0, 255-(255/steps)*j), &lt;br /&gt;
        color(0, 0, 255-(255/steps)*j), &lt;br /&gt;
        color(0, 255-(255/steps)*j, (255/2.5)-((255/2.5)/steps)*j), &lt;br /&gt;
        color(0, 255-(255/steps)*j, 0), &lt;br /&gt;
        color((255/2)-((255/2)/steps)*j, 255-(255/steps)*j, 0)&lt;br /&gt;
      };&lt;br /&gt;
      for (int i = 0; i &amp;lt; segs; i++) {&lt;br /&gt;
        fill(cols[i]);&lt;br /&gt;
        arc(width/2, height/2, radius, radius, &lt;br /&gt;
        interval*i+rotAdjust, interval*(i+1)+rotAdjust);&lt;br /&gt;
      }&lt;br /&gt;
      radius -= segWidth;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Check whether the mouse movement through the interface&lt;br /&gt;
  boolean mouseOverRect() { // Test if mouse is over square&lt;br /&gt;
    return ((mouseX &amp;gt;= 10) &amp;amp;&amp;amp; (mouseX &amp;lt;= 190) &amp;amp;&amp;amp; (mouseY &amp;gt;= 10) &amp;amp;&amp;amp; (mouseY &amp;lt;=190));&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
//Got the RGB value, write to pin9,10,11&lt;br /&gt;
  void draw() {&lt;br /&gt;
    // nothing happens here&lt;br /&gt;
    if (mouseOverRect() == true)&lt;br /&gt;
    {&lt;br /&gt;
      color targetColor = get(mouseX, mouseY);&lt;br /&gt;
      // get the component values:&lt;br /&gt;
      int r = int(red(targetColor));&lt;br /&gt;
      int g = int(green(targetColor));&lt;br /&gt;
      int b = int(blue(targetColor));&lt;br /&gt;
      // analogWirte to pin&lt;br /&gt;
      arduino.analogWrite(9, r);&lt;br /&gt;
      arduino.analogWrite(10, g);&lt;br /&gt;
      arduino.analogWrite(11, b);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Step 3: Compile the code and download it.&lt;br /&gt;
&lt;br /&gt;
Step 4: After runing, will display a palette, click on the color of your choice, observe the  color of the LED light.&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
A color selector will display on screen, as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:processingControlRGBLEDResult.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pkj</name></author>	</entry>

	</feed>