Instructions
25/06/2015 DFRduinoBeginnerKitForArduinoV3SKU:DFR0100RobotWiki
http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 15/23
12.RGBLightDimmer
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
RGBLightDimmer
*/
intredPin=9;//R–digital9
intgreenPin=10;//G–digital10
intbluePin=11;//B–digital11
intpotRedPin=0;//potentiometer1–analog0
intpotGreenPin=1;//potentiometer2–analog1
intpotBluePin=2;//potentiometer3–analog2
voidsetup(){
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT);
Serial.begin(9600);
}
voidloop(){
intpotRed=analogRead(potRedPin);
intpotGreen=analogRead(potGreenPin);
intpotBlue=analogRead(potBluePin);