|
本帖最後由 dark-man 於 2013-3-17 15:55 編輯
之前照著範例Multicolor Lamp tutorial做
Multicolor Lamp tutorial的控制端是用拉條控制LED亮度
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int redled = 9;
int greenled = 10;
int yellowled = 11;
void setup()
{
Serial.begin(57600);
meetAndroid.registerFunction(redled, 'r');
meetAndroid.registerFunction(greenled, 'g');
meetAndroid.registerFunction(yellowled, 'y');
pinMode(redled, OUTPUT);
pinMode(greenled, OUTPUT);
pinMode(yellowled, OUTPUT);
digitalWrite(redled, HIGH);
digitalWrite(greenled, HIGH);
digitalWrite(yellowled, HIGH);
}
void loop()
{
meetAndroid.receive();
}
void red(byte flag, byte numOfValues)
{
analogWrite(redLed, meetAndroid.getInt());
}
void green(byte flag, byte numOfValues)
{
analogWrite(greenLed, meetAndroid.getInt());
}
void blue(byte flag, byte numOfValues)
{
analogWrite(blueLed, meetAndroid.getInt());
}
其中對以下這段的函數不是很懂
void red(byte flag, byte numOfValues)<-不是很懂它的宣告函數
{
analogWrite(redLed, meetAndroid.getInt());
請懂這部份得大大 幫忙求解 !! |
|