Robofun 機器人論壇
標題:
MultiColorLamp 問題
[打印本頁]
作者:
frty5566
時間:
2012-11-12 09:21
標題:
MultiColorLamp 問題
我是用現成的APK 裝在手機上
所以才打成 meetAndroid.registerFunction(red, 'r');
meetAndroid.registerFunction(green, 'g');
meetAndroid.registerFunction(blue, 'b');
但是燒到板子上 有時候會動 有時候又沒反應 明明都是用一樣的東西
不知道為什麼不會動 我確定電路沒有接錯 請問是為什麼
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int redLed = 9;
int greenLed = 10;
int blueLed = 11;
void setup()
{
Serial.begin(57600);
meetAndroid.registerFunction(red, 'r');
meetAndroid.registerFunction(green, 'g');
meetAndroid.registerFunction(blue, 'b');
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(blueLed, OUTPUT);
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, HIGH);
digitalWrite(blueLed, 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());
}
歡迎光臨 Robofun 機器人論壇 (https://robofun.net/forum/)
Powered by Discuz! X3.2