#7995
STEP1: Preparation:
______________________________________________________________________________________________

Hardware:

(509.74 KiB) Downloaded 2261 times

1. USB to TTL Converter x1
2. Expansion shield x1
3. Phone with BT2.0 above x1
4. BT3.0 module x1
5. DFRobot Uno x1 ( Compatible with Arduino Uno)

Software:
1. Arduino IDE
2. BT serial App for your phone, here I used one for Android (Bluetooth Terminal.apk)
(1.95 MiB) Downloaded 620 times



Note: The switch of the AT mode should be on the correct position, or it doesn't work. :)

(291.24 KiB) Downloaded 2261 times




STEP2 Setting BT Module
_______________________________________________________________________________________________
(138.97 KiB) Downloaded 2261 times


1. Default setting is ok. Visit wiki for how.



STEP3 Download Sketch to Uno

_______________________________________________________________________________________________

(255.49 KiB) Downloaded 2261 times

plz turn expansion switch "PROG/RUN" to PROG or will cause upload fail. :!: And remember turn it to RUN after finishing uploading. ;)


The sketch here is to receive the data from serial port ( i.e. BT module), and then, it will
1) Turn On the LED on D13 if you send "1";
2) Turn OFF the LED on D13 if you send "0";
3) Store the command and print out through serial port.

Code: Select all
String val = "";
boolean mark = LOW;

void setup() {
  Serial.begin(38400);  //initial the Serial
  pinMode(13, OUTPUT);
}

void loop() {
  while (Serial.available()) {
    val += char(Serial.read());
    delay(2);   // Can't be deleted for it needs time to read serial
    mark = HIGH;
  }

  if (val.length() == 1) {    //Send command without CR/ LF/ NL
    if (val == "1") {
      digitalWrite(13, HIGH); //turn on the LED on D13
      Serial.println("LED is ON!");
    }
    else if (val == "0") {
      digitalWrite(13, LOW);  //Trun off
      Serial.println("LED is OFF!");
    }
  }

  if (mark == HIGH) {
    Serial.print("Length: ");      Serial.println(val.length());
    Serial.print("Val: ");        Serial.println(val); delay(50);
    Serial.println("Done");       Serial.println();
    Serial.flush();
    val = "";
    mark = LOW;
  }
}




STEP4 Connect BT module with your phone

_______________________________________________________________________________________________

1). Connect BT module from SETTING PANEL
______________________________________

(95.87 KiB) Downloaded 2261 times




2). Open app "Bluetooth Terminal", and set its command sending format as NONE, then send command as you want, here, I sent

1. 1 -> Turn on the LED
2. 0 -> Turn off the LED
3. Test finished!
______________________________________

(170.07 KiB) Downloaded 2261 times


(239.33 KiB) Downloaded 2261 times




One more thing: You can also open Arduino Serial Monitor to receive the feedback info

______________________________________

(12.22 KiB) Downloaded 2261 times

_______________________________________________________________________________________________
#11282
Hello there ! this news awesome for me ,i really want to know about it and now i got it and i appreciate this forum who give me always best updates,thank you all community for this pleasure :)


_________________________________________________________________________
www.dissertationhomework.com