BTduino - Arduino - Bluetooth 1.7

Lisans: Ücret -siz ‎Dosya boyutu: 1.05 MB
‎Kullanıcı Derecelendirmesi: 0.0/5 - ‎0 ‎Oy

BTduino 是利用手機藍芽 #35037;置(Bluetooth)連#25509; Arduino 的應用 #27169;模 #31243 #12290 #22120 #21046 #25511 #25138 #36938 #24335 #27169 #37749 #25353 #23383 #25976 #20379 #25552 #31243 #27492 #12290 #24335;現及模往亦 #24460;加入PWM&##6 55292;各種感應器及按鍵配對等功能。使用者需連接藍芽接收裝ಾࢮࢮHC06至Arduino。藍芽HC06連接Arduino的設置如下ᦈ 1. 藍芽VCC接Arduino 5v或3.3v(視乎所 #36023;購所 #35037;的置而 #23450 2. 藍芽GND接Arduino GND 3. 藍芽ArXD接Arduino TX(Pin10) 4. 藍芽TXD接Arduino RX(Pin11) Arduino RX(Pin 11) Bluethooth TX'e, Arduino TX(Pin 10) Bluethooth RX'e bağlanın

Arduino 設定 /* btduino2 - Terminal Modu - David Chung tarafından */ # include

SoftwareSerial myBT(11, 10); const int ledPin = 13; String inCode = ""; boolean endCode = yanlış;

void kurulum() { Serial.begin(9600); myBT.begin(9600); pinMode(ledPin, OUTPUT); inCode.reserve(50); }

void loop() { if (myBT.available()) { char gelenChar = myBT.read(); if(incomingChar == ')){ endCode = true; } else { inCode += gelenChar; } }

if (endCode){ int strEnd = inCode.indexOf(')'); String myString = inCode.substring(0, strEnd);

Serial.print("Gelen : "); Serial.println(myString); if(myString == "on"){ digitalWrite(ledPin, HIGH); myBT.print("LED A)); } if(myString == "kapalı"){ digitalWrite(ledPin, LOW); myBT.print("LED Off"); } inCode = ""; endCode = yanlış; } }

/* btduino2 - GamePad Modu - David Chung tarafından */ # include

SoftwareSerial myBT(11, 10); const int ledPin = 13; int gelenByte = 0;

void kurulum() { Serial.begin(9600); myBT.begin(9600); pinMode(ledPin, OUTPUT); }

void loop() { if (myBT.available()) { gelenByte = myBT.read(); Serial.println(char(gelenByte)); if(gelenByte == 'L'){ digitalWrite(ledPin, HIGH); } if(gelenByte == 'R'){ digitalWrite(ledPin, LOW); } } }

/* Kaydırıcı Modu */ # include

SoftwareSerial myBT(11, 10); const int ledPin = 13; String inCode = "";

boolean endCode = yanlış;

void kurulum() { Serial.begin(9600); myBT.begin(9600); pinMode(ledPin, OUTPUT); inCode.reserve(30); }

void loop() { if (myBT.available()) { char gelenChar = myBT.read(); if(incomingChar == ')){ endCode = true; } else { inCode += gelenChar; } }

if (endCode){ int comma1 = inCode.indexOf(','); int comma2 = inCode.indexOf(',', virgül1 + 1); String Rs = inCode.substring(0, virgül1); String Gs = inCode.substring(comma1 + 1, virgül2); String Bs = inCode.substring(virgül2 + 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 = yanlış; } }

/* btduino2 - Oryantasyon Modu - David Chung tarafından */ # include

SoftwareSerial myBT(11, 10); const int ledPin = 13; String inCode = ""; boolean endCode = yanlış;

void kurulum() { Serial.begin(9600); myBT.begin(9600); pinMode(ledPin, OUTPUT); inCode.reserve(30); }

void loop() { if (myBT.available()) { char gelenChar = myBT.read(); if(incomingChar == ')){ endCode = true; } else { inCode += gelenChar; } }

if (endCode){ int comma1 = inCode.indexOf(','); int comma2 = inCode.indexOf(',', virgül1 + 1); String As = inCode.substring(0, virgül1); String Ps = inCode.substring(comma1 + 1, virgül2); 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 = yanlış; } }

sürüm geçmişi

  • Sürüm 1.7 tarihinde gönderildi 2015-11-30
    修 Yön Değiştirme Modu輸

Program Detayları