<?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_04_-_Breathing_LED_experiment</id>
		<title>Maple Lesson 04 - Breathing LED experiment - 版本历史</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_04_-_Breathing_LED_experiment"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Maple_Lesson_04_-_Breathing_LED_experiment&amp;action=history"/>
		<updated>2026-04-21T09:37:38Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Maple_Lesson_04_-_Breathing_LED_experiment&amp;diff=3824&amp;oldid=prev</id>
		<title>Jasonsheng：Created page with &quot;{| style=&quot;width: 800px;&quot; |- | ==Objective== In previous experiment, LED only has two states, on and off. This experiment implemented a led fade in dimming, named breathing lam...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Maple_Lesson_04_-_Breathing_LED_experiment&amp;diff=3824&amp;oldid=prev"/>
				<updated>2014-08-21T12:43:40Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== In previous experiment, LED only has two states, on and off. This experiment implemented a led fade in dimming, named breathing lam...&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;
In previous experiment, LED only has two states, on and off. This experiment implemented a led fade in dimming, named breathing lamp.&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;
**LED Light-emitting diodes one&lt;br /&gt;
**220ohm resistor one&lt;br /&gt;
**Button         one&lt;br /&gt;
**USB Data cable one&lt;br /&gt;
&lt;br /&gt;
[[File:maple-lesson4-All.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
This experiment uses PWM to control the LED. This method adjusts the digital signal (&amp;quot; 0 &amp;quot;, &amp;quot;1&amp;quot;) value within a period of time that is the time of the duty ratio to control the brightness of LED.&lt;br /&gt;
If the high voltage &amp;quot;1&amp;quot; lasts long time, the LED will light longer. For PWM's detailed information, please refer to: http://www.geek-workshop.com/thread-125-1-1.html &lt;br /&gt;
&lt;br /&gt;
But not all of the I/O ports can be used for the PWM, only several special port can be used.&lt;br /&gt;
&lt;br /&gt;
Microduino-CoreSTM32's PWM I/O ports：'''0,1,4,11,12,14(A0),15(A1),16(A2),17(A3),18(SDA),19(SCL),20(A6),21(A7)''', we can use the LED on board directly, because it connects to the D4 pin. You also can use other PWM port to try.&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 ledPin=4;// 0,1,4,11,12,14(A0),15(A1),16(A2),17(A3),18(SDA),19(SCL),20(A6),21(A7) is the PWM port&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  pinMode(ledPin, PWM);&lt;br /&gt;
}&lt;br /&gt;
void loop(){&lt;br /&gt;
  for(int fadeValue=0;fadeValue&amp;lt;=65535;fadeValue+=500)&lt;br /&gt;
    //Control the PWM value using variable fadeValue, PWM will increase.&lt;br /&gt;
  {&lt;br /&gt;
    pwmWrite(ledPin,fadeValue);   //Write the brightness level to LED&lt;br /&gt;
    delay(30);                       //Set the during timer, the unit is ms &lt;br /&gt;
  }&lt;br /&gt;
  for(int fadeValue=65535;fadeValue&amp;gt;=0;fadeValue-=500)&lt;br /&gt;
    //Control the PWM value using variable fadeValue, PWM will decrease.&lt;br /&gt;
  {&lt;br /&gt;
    pwmWrite(ledPin,fadeValue); //Write the brightness level to LED&lt;br /&gt;
    delay(30);                     //Set the during timer, the unit is ms &lt;br /&gt;
  }&lt;br /&gt;
  delay(400);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Grammar：&lt;br /&gt;
&lt;br /&gt;
*'''pwmWrite(ledPin,fadeValue);''', this function writes a PWM value to I/O port, this port will output a square wave. You can adjust the input value to change the duty ratio to realize the PWM control.&lt;br /&gt;
**ledPin ：PWM input pin &lt;br /&gt;
**fadeValue: Duty ratio setting.&lt;br /&gt;
You need pay attention to that：'''Define the output as PWM mode, that is“pinMode(ledPin, PWM);”'''&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
*Open the Maple IDE, copy the program to IDE, choose board type (Microduino-CoreSTM32 to Flash), click the download button or use the (Ctrl+U) to finish the download.&lt;br /&gt;
*After download, you can see that the LED's brightness changes from off to on then to off softly in cycle.&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jasonsheng</name></author>	</entry>

	</feed>