Computers
Computer Parts
Custom PC Builder
DIY/ Maker
{$smarty.capture.menu}
Activity
Categories
Discussions
Computers
Computer Parts
Custom PC Builder
DIY/ Maker
Inland Pro Micro Starter Kit - Micro Center
<main> <article class="userContent"> <h2 data-id="inland-pro-micro-starter-kit"><strong>Inland Pro Micro Starter Kit</strong></h2><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/HCX6XO2E1CS0/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/HCX6XO2E1CS0/image.png" alt="image.png" height="666" width="827" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <h2 data-id="contents"><strong>Contents</strong></h2><p>1. Description</p><p>2. Component List</p><p>3. Installing Arduino IDE And Driver</p><p>4. Specification</p><p>5. Projects</p><ul><li>Hello World!</li><li>LED Blinking</li><li>Advertising Lights</li><li>Button Controlling LED</li><li>RGB LED</li><li>Photosensitive LED</li></ul><p>6. Resources</p><p><br></p><p> </p><h2 data-id="1.-description">1. Description</h2><p>Containing resistors with different resistance values, different colors LEDs, buttons, IR receiving components, this kit is compatible with various microcontrollers and Raspberry Pi.</p><p>Included in this kit, the Micro control board belongs to the Arduino series microcontroller and is compatible with the Arduino development platform.</p><p>To make you have a better understanding with these components and Micro control board, we will also provide some learning courses based on the Arduino, like wiring methods, test code, etc.</p><h2 data-id="2.-component-list">2. Component List</h2><div class="embedExternal embedImage display-large float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/PNXTT0AH6DJL/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/PNXTT0AH6DJL/image.png" alt="image.png" height="317" width="562" loading="lazy" data-display-size="large" data-float="none"></img></a> </div> </div> <div class="embedExternal embedImage display-large float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/BD4TUWVUHJLL/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/BD4TUWVUHJLL/image.png" alt="image.png" height="795" width="560" loading="lazy" data-display-size="large" data-float="none"></img></a> </div> </div> <div class="embedExternal embedImage display-large float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/NB9X2J05BUYP/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/NB9X2J05BUYP/image.png" alt="image.png" height="858" width="558" loading="lazy" data-display-size="large" data-float="none"></img></a> </div> </div> <div class="embedExternal embedImage display-large float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/YX0V0TO33R1V/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/YX0V0TO33R1V/image.png" alt="image.png" height="544" width="560" loading="lazy" data-display-size="large" data-float="none"></img></a> </div> </div> <p><br></p><h2 data-id="3.-installing-arduino-ide-and-driver">3. Installing Arduino IDE And Driver</h2><p>When we get the development board, we firstly need to install the Arduino IDE and driver. The related files can be found on the official website. The following links you could refer to:</p><p><a href="https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x" rel="nofollow noreferrer ugc">https://www.arduino.cc/en/Main/OldSoftwareReleases#1.5.x</a></p><p>Next to introduce installation method of Arduino-1.5.6 version IDEfor Windows system.</p><p>Download arduino-1.5.6-r2-windows.zip compressed folder and unzip it.</p><p>Double click Arduino-1.5.6 .exe file</p><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/1PXVF1AM0TXZ/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/1PXVF1AM0TXZ/image.png" alt="image.png" height="325" width="472" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <p>Next step</p><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/2DDWCLOD3YGD/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/2DDWCLOD3YGD/image.png" alt="image.png" height="329" width="472" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <p>Next step</p><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/YQSJHVZD4DHZ/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/YQSJHVZD4DHZ/image.png" alt="image.png" height="328" width="472" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <p>Complete driver installation, click “Close” as shown below </p><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/UXBAW5B2BPLU/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/UXBAW5B2BPLU/image.png" alt="image.png" height="331" width="472" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/80JADLCQ8QRP/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/80JADLCQ8QRP/image.png" alt="image.png" height="561" width="467" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <p>Next to install Micro control board. This control board uses ATmega32u4 main chip and comes with USB to serial port function.</p><p> For Windows 10 system, the computer will automatically install the driver after connecting the Micro control board to the computer with a micro USB cable.</p><p>Click Computer--Properties--Device Manager, as shown below.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/4I6M7CW40L2J/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/4I6M7CW40L2J/image.png" alt="image.png" height="430" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>For other systems (Windows system), after connecting to the computer, the unknown device is displayed in the device manager. We can refer to the method of changing the driver on the computer ( Windows system) and reinstalling the driver.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/I4YFYFK1PYMS/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/I4YFYFK1PYMS/image.png" alt="image.png" height="430" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Enter the following page.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/CJR2LNSYCIRO/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/CJR2LNSYCIRO/image.png" alt="image.png" height="430" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Find Arduino IDE installing address and drivers file, such as my defined driver address:</p><p>C:\Program Files (x86)\Arduino\drivers</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/9SGS1WOQCLNU/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/9SGS1WOQCLNU/image.png" alt="image.png" height="430" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Click “Next Step” to start installing.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/AW421ASTSQC6/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/AW421ASTSQC6/image.png" alt="image.png" height="430" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Finish installing, click to “close”</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/FAG0BVQGQ2CP/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/FAG0BVQGQ2CP/image.png" alt="image.png" height="469" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>The driver is now installed. Click Computer-Properties-Device Manager, as shown below:</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/N13E0M95HLHQ/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/N13E0M95HLHQ/image.png" alt="image.png" height="430" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <h2 data-id="4.-specification">4. Specification</h2><p>Micro Control Board:</p><p>Digital port:RX(D0)、TX(D1)、D2-D10、D14-D16、A0-A3(D18-D21)</p><p>Digital port:A0-A3、D4(A6)、D6(A7)、D8(A8)、D9(A9)、D10(A10)</p><p>PWM port (Pulse width modulation):D3、D5、D6、D9、D10</p><p>External Interrupt interface:D3 (interrupt 0), D2 (interrupt 1), D0 (interrupt 2), D1 (interrupt 3), and D7 (interrupt 4)</p><p>Serial communication interface:RX(D0)、TX(D1)</p><p>SPI communication interface:D14(MISO)、D15(SCLK)、D16(MOSI)</p><p>I2C communication interface:D2(SDA)and D3(SCL)</p><p>RAW: external power supply DC 7-9V</p><p> </p><h2 data-id="5.-projects">5. Projects</h2><h2 data-id="-1"></h2><h2 data-id="hello-world!">Hello World! </h2><h3 data-id="description"><strong>Description</strong></h3><p>After installing USB driver of Micro control board, we can find the corresponding serial port in Windows Device Manager. The burning of the first program is shown below. The serial monitor shows "Hello world!".</p><h3 data-id="equipment"><strong>Equipment</strong></h3><ul><li>Micro control board*1</li><li>USB cable*1</li></ul><h3 data-id="wiring-diagram"><strong>Wiring Diagram</strong></h3><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/0ZONBH5A83JR/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/0ZONBH5A83JR/image.png" alt="image.png" height="255" width="588" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <h3 data-id="test-code"><strong>Test Code</strong></h3><pre class="code codeBlock" spellcheck="false" tabindex="0">int val; int ledpin=13; void setup() { Serial.begin(9600); pinMode(ledpin,OUTPUT); } void loop() { val=Serial.read(); if(val=='R') { digitalWrite(ledpin,HIGH); delay(500); digitalWrite(ledpin,LOW); delay(500); Serial.println("Hello World!"); } } </pre><h3 data-id="test-result"> <strong>Test Result</strong></h3><p>Open Arduino software, set board as shown below.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/PAKR7HA97JLQ/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/PAKR7HA97JLQ/image.png" alt="image.png" height="662" width="632" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Set COM port, as shown below.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/T9YYC7AWN5CJ/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/T9YYC7AWN5CJ/image.png" alt="image.png" height="709" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Click <strong>Verify </strong>to compile the program, check if the program is right; click</p><p><strong>Upload </strong>to upload program; after setting up Micro control board, as shown below:</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/HDCXBBDV9ME0/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/HDCXBBDV9ME0/image.png" alt="image.png" height="709" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Upload successfully, enter “R”, click to “send”, serial monitor displays “ Hello World!” </p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/73ULBWDVZ8Z0/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/73ULBWDVZ8Z0/image.png" alt="image.png" height="559" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <p>Congratulation! Upload successfully!</p><p><br></p><p><br></p><p><br></p><h2 data-id="-2"></h2><h2 data-id="led-blinking">LED Blinking</h2><h3 data-id="description-1"><strong>Description</strong></h3><p>The blinking LED experiment is quite simple. In this experiment, we’ll complete experiment using other digital I/O ports and external light.</p><h3 data-id="equipment-1"><strong>Equipment</strong></h3><ul><li>Micro control board*1</li><li>USB cable*1</li><li>LED*1 </li><li>220Ω Resistor*1</li><li>Breadboard*1</li><li>Male to female Dupont Lines</li></ul><h3 data-id="wiring-diagram-1"><strong>Wiring Diagram</strong></h3><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/WINK3690UQWT/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/WINK3690UQWT/image.png" alt="image.png" height="781" width="591" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <h3 data-id="test-code-1"><strong>Test Code</strong></h3><pre class="code codeBlock" spellcheck="false" tabindex="0">int led = 2; //Define digital port 2 void setup() { pinMode(led, OUTPUT); //Set led to output} void loop() { digitalWrite(led, HIGH); //Turn on led delay(1000); //delay for 1000ms digitalWrite(led, LOW); //Turn off led delay(1000);//delay for 1000ms } </pre><h3 data-id="test-result-1"><strong>Test Result</strong></h3><p>After downloading program, you will see the LED connected to IO port blinking, with an interval approximately one second. The blinking LED experiment is now completed.</p><p><br></p><p><br></p><p><br></p><h2 data-id="-3"></h2><h2 data-id="advertising-lights"><strong>Advertising Lights</strong></h2><h3 data-id="description-2"><strong>Description</strong></h3><p>In life, we often see some billboards composed of colorful led lights. Different effects shown on billboard as lights change. In this section, we simulate the effect of advertising lights with LED lights.</p><h3 data-id="equipment-2"><strong>Equipment</strong></h3><ul><li>Micro control board*1</li><li>USB cable*1</li><li>LED*5 </li><li>220Ω Resistor*5</li><li>Breadboard*1</li><li>Male to female Dupont Lines</li><li>Male to male Dupont Lines</li></ul><h3 data-id="wiring-diagram-2"><strong>Wiring Diagram</strong></h3><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/ZQTVFCL8SG4B/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/ZQTVFCL8SG4B/image.png" alt="image.png" height="817" width="591" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <h3 data-id="test-code-2"><strong>Test Code</strong></h3><pre class="code codeBlock" spellcheck="false" tabindex="0">int BASE = 2 ; //the first LED is connected to I/O port int NUM = 5; //the sum of LED void setup() { for (int i = BASE; i < BASE + NUM; i ++) { pinMode(i, OUTPUT); //set I/O port to output } } void loop() { for (int i = BASE; i < BASE + NUM; i ++) { digitalWrite(i, HIGH); //set I/O to “HIGH”, light is on delay(200); //delay } for (int i = BASE; i < BASE + NUM; i ++) { digitalWrite(i, LOW); //set I/O to “LOW”", light is off delay(200); //delay } } </pre><h3 data-id="test-result-2"> <strong>Test Result</strong></h3><p>After downloading the program, the external small light gradually brightens then darkens, and alternates.</p><p><br></p><p><br></p><p><br></p><h2 data-id="-4"></h2><h2 data-id="button-controlling-led">Button Controlling LED</h2><h3 data-id="description-3"><strong>Description</strong></h3><p>I/O port means interface for INPUT and OUTPUT. Up until now, we’ve only used the output function. </p><p>In this experiment, we will try to use the input function, which is to read the output value of device. We’ll complete an experiment with use 1 button and 1 LED to give you a better understanding of the I/O function. </p><h3 data-id="equipment-3"><strong>Equipment</strong></h3><ul><li>Micro control board*1</li><li>USB cable*1</li><li>LED*1 </li><li>Button *1 </li><li>220Ω Resistor*1</li><li>10KΩ Resistor*1</li><li>Breadboard*1</li><li>Male to female Dupont Lines</li><li>Male to male Dupont Lines</li></ul><h3 data-id="wiring-diagram-3"><strong>Wiring Diagram</strong></h3><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/JXU0RW4APIZK/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/JXU0RW4APIZK/image.png" alt="image.png" height="805" width="591" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <h3 data-id="test-code-3"><strong>Test Code</strong></h3><pre class="code codeBlock" spellcheck="false" tabindex="0">int ledPin = 7; //define digital port 7 int inputPin = 2; //define digital port 2 void setup() { pinMode(ledPin, OUTPUT); //set ledPinto to output pinMode(inputPin, INPUT); //set inputPin to input } void loop() { int val = digitalRead(inputPin); //set digital variable val,read the value of digital port 2,assign the value for val if (val == LOW) //when val is low level,LED gets dark { digitalWrite(ledPin, LOW); // LED gets dark } else { digitalWrite(ledPin, HIGH); // LED gets bright } } </pre><h3 data-id="test-result-3"><strong>Test Result</strong></h3><p>After downloading the program and powering on, the LED light is on when the button is pressed, otherwise it is off.</p><p><br></p><p><br></p><h2 data-id="-5"></h2><h2 data-id="rgb-led">RGB LED</h2><h3 data-id="description-4"><strong>Description </strong></h3><p>RGB lights can adjust the intensity of three primary colors (red / blue / green) through the PWM voltage input of the three pins R, G, and B to achieve the full-color mixing effect.</p><p>In this experiment, we control the RGB lights to display different colors by controlling the PWM values of the three PWM ports. The description of the RGB light interfaces are shown below.</p><div class="embedExternal embedImage display-medium float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/QL1AM0U7GJUB/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/QL1AM0U7GJUB/image.png" alt="image.png" height="461" width="756" loading="lazy" data-display-size="medium" data-float="none"></img></a> </div> </div> <h3 data-id="equipment-4"><strong>Equipment</strong></h3><ul><li>Micro control board*1</li><li>USB cable*1</li><li>RGB LED*1 </li><li>220Ω Resistor*3</li><li>Breadboard*1</li><li>Dupont Lines</li><li>Breadboard cables</li></ul><h3 data-id="wiring-diagram-4"><strong>Wiring Diagram</strong></h3><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/QF8IHTOLIH20/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/QF8IHTOLIH20/image.png" alt="image.png" height="825" width="591" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <h3 data-id="test-code-4"><strong>Test Code</strong></h3><pre class="code codeBlock" spellcheck="false" tabindex="0">int redpin = 9 //select the pin for the red LED int greenpin =6;// select the pin for the green LED int bluepin =5; // select the pin for the blue LED int val; void setup() { pinMode(redpin, OUTPUT); pinMode(bluepin, OUTPUT); pinMode(greenpin, OUTPUT); Serial.begin(9600); } void loop() { for(val=255; val>0; val--) { analogWrite(9, val); analogWrite(6, 255-val); analogWrite(5, 128-val); delay(1); } for(val=0; val<255; val++) { analogWrite(9, val); analogWrite(6, 255-val); analogWrite(5, 128-val); delay(1); } Serial.println(val, DEC); } </pre><h3 data-id="test-result-4"><strong>Test Result</strong></h3><p>After downloading the program and powering on, the external RGB light displays various colors alternately.</p><p><br></p><p><br></p><p><br></p><h2 data-id="photosensitive-led"><strong>Photosensitive LED</strong></h2><h3 data-id="description-5"><strong>Description</strong></h3><p>Since the photo resistor is an element that can change the resistance value according to the light intensity, the analog value needs to be read via analog port.</p><p>In this experiment, we design a circuit that reading different analog value and mapping analog value into PWM value under different light intensities, which controls the brightness of LED. Therefore, we achieve different brightness change of led as light intensity changes.</p><h3 data-id="equipment-5"><strong>Equipment</strong></h3><ul><li>USB cable*1</li><li>Micro control board*1</li><li>LED*1 </li><li>Photo resistor*1</li><li>220Ω Resistor*1</li><li>10KΩ Resistor*1</li><li>Breadboard*1</li><li>Male to female Dupont Lines</li><li>Male to male Dupont Lines</li></ul><h3 data-id="wiring-diagram-5"><strong>Wiring Diagram</strong></h3><div class="embedExternal embedImage display-small float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6031942/uploads/SJRNX1Z1MD9N/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6031942/uploads/SJRNX1Z1MD9N/image.png" alt="image.png" height="806" width="591" loading="lazy" data-display-size="small" data-float="none"></img></a> </div> </div> <h3 data-id="test-code-5"><strong>Test Code</strong></h3><pre class="code codeBlock" spellcheck="false" tabindex="0">int ledpin=6;//define digital port 6 (PWM outputs) void setup() { pinMode(ledpin,OUTPUT);//set digital port 6 to output Serial.begin(9600);//set baud rate to 9600 } void loop() { int val=analogRead(0);//read value of analog port A0 Serial.println(val);//display val variable val = map(val, 0, 1023, 0, 255);//map form 0-1023 to 0-255 analogWrite(ledpin,255-val);// turn on LED and set the brightness delay(10);//delay for 0.01s } </pre><h3 data-id="test-result-5"><strong>Test Result</strong></h3><p>After downloading the program, the photo resistor senses that the brighter the light, the darker the LED; it senses that the darker the light, the brighter the LED. Open the serial port monitor, set baud rate to 9600, and you can see the analog value of photo resistor that senses the external light intensity.</p> </article> </main>