Arduino 設定
/*
btduino2 - Terminal Mode - by David Chung
*/
#include
SoftwareSerial myBT(11, 10);
const int ledPin = 13;
String inCode = "";
boolean endCode = false;
void setup() {
Serial.begin(9600);
myBT.begin(9600);
pinMode(ledPin, OUTPUT);
inCode.reserve(50);
}
void loop() {
if (myBT.available()) {
char incomingChar = myBT.read();
if(incomingChar == ')'){
endCode = true;
} else {
inCode += incomingChar;
}
}
if (endCode){
int strEnd = inCode.indexOf(')');
String myString = inCode.substring(0, strEnd);
Serial.print("Incoming : ");
Serial.println(myString);
if(myString == "on"){
digitalWrite(ledPin, HIGH);
myBT.print("LED On");
}
if(myString == "off"){
digitalWrite(ledPin, LOW);
myBT.print("LED Off");
}
inCode = "";
endCode = false;
}
}
/*
btduino2 - GamePad Mode - by David Chung
*/
#include
SoftwareSerial myBT(11, 10);
const int ledPin = 13;
int incomingByte = 0;
void setup() {
Serial.begin(9600);
myBT.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (myBT.available()) {
incomingByte = myBT.read();
Serial.println(char(incomingByte));
if(incomingByte == 'L'){
digitalWrite(ledPin, HIGH);
}
if(incomingByte == 'R'){
digitalWrite(ledPin, LOW);
}
}
}
/*
Slider Mode
*/
#include
SoftwareSerial myBT(11, 10);
const int ledPin = 13;
String inCode = "";
boolean endCode = false;
void setup() {
Serial.begin(9600);
myBT.begin(9600);
pinMode(ledPin, OUTPUT);
inCode.reserve(30);
}
void loop() {
if (myBT.available()) {
char incomingChar = myBT.read();
if(incomingChar == ')'){
endCode = true;
} else {
inCode += incomingChar;
}
}
if (endCode){
int comma1 = inCode.indexOf(',');
int comma2 = inCode.indexOf(',', comma1 + 1);
String Rs = inCode.substring(0, comma1);
String Gs = inCode.substring(comma1 + 1, comma2);
String Bs = inCode.substring(comma2 + 1);
Serial.print("inCode = ");
Serial.print(inCode);
Serial.print(" R = ");
Serial.print(Rs);
Serial.print(" G = ");
Serial.print(Gs);
Serial.print(" B = ");
Serial.println(Bs);
int R = Rs.toInt();
int G = Gs.toInt();
int B = Bs.toInt();
analogWrite(ledPin, R);
inCode = "";
endCode = false;
}
}
/*
btduino2 - Orientation Mode - by David Chung
*/
#include
SoftwareSerial myBT(11, 10);
const int ledPin = 13;
String inCode = "";
boolean endCode = false;
void setup() {
Serial.begin(9600);
myBT.begin(9600);
pinMode(ledPin, OUTPUT);
inCode.reserve(30);
}
void loop() {
if (myBT.available()) {
char incomingChar = myBT.read();
if(incomingChar == ')'){
endCode = true;
} else {
inCode += incomingChar;
}
}
if (endCode){
int comma1 = inCode.indexOf(',');
int comma2 = inCode.indexOf(',', comma1 + 1);
String As = inCode.substring(0, comma1);
String Ps = inCode.substring(comma1 + 1, comma2);
String Rs = inCode.substring(comma2 + 1);
Serial.print("inCode = ");
Serial.print(inCode);
Serial.print(" Azimuth = ");
Serial.print(As);
Serial.print(" Pitch = ");
Serial.print(Ps);
Serial.print(" Roll = ");
Serial.println(Rs);
int A = As.toInt();
int P = Ps.toInt();
int R = Rs.toInt();
inCode = "";
endCode = false;
}
}
We do not host BTduino - Arduino - Bluetooth on our servers. We did not scan it for viruses, adware, spyware or other type of malware. This app is hosted by Galad and passed their terms and conditions to be listed there. We recommend caution when installing it.
The APK Download link for BTduino - Arduino - Bluetooth is provided to you by apps112.com without any warranties, representations or guarantees of any kind, so access it at your own risk.
If you have questions regarding this particular app contact the publisher directly. For questions about the functionalities of apps112.com contact us.
| ||||
Downloads: 37 | ||||
Updated At: 2024-04-23 10:11:46 | ||||
Publisher: Chung Siu Wing, David | ||||
Operating System: Android | ||||
License Type: Free |