Introduction: LED數字命令式閃耀燈泡

I will today tell you how to control a RGB LED with help of Arduino and Processing language. This is my first instructable So, please let me know if I could anything improve and if you have any kind of questions leave them in the comment box, I would love to answer them.

Simply you need the following items for this sweet little project.

1 X RGB LED

Arduino

8 X Connecting

Wiresreflecting sheet ( optional)

1 X Breadboard

以上為原文

我所使用的材料有 三顆LED燈泡與Arduino和麵包版 電線電阻等等的基本材料

Step 1: 程式碼

// Output

int redPin = 9; // Red LED, connected to digital pin 9 int greenPin = 10; // Green LED, connected to digital pin 10 int bluePin = 11; // Blue LED, connected to digital pin 11

long int inByte; int wait = 10; //10ms

void setup() { pinMode(redPin, OUTPUT); // sets the pins as output pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); Serial.begin(9600); }

void outputColour(int red, int green, int blue) { analogWrite(redPin, red); analogWrite(bluePin, blue); analogWrite(greenPin, green); }

int* getColour() { int* colour; int i; i = 0; //for some reason it only works if we put a dud value between the C and // the R value while (i < 4) { if (Serial.available() > 0) { colour[i] = Serial.read(); i++; } }

Step 2:

Step 3: 程式碼

https://create.arduino.cc/editor/wjfipdjfspidvjsdp/99cae9a8-c480-4933-af6e-89cfb1ca1891/preview