ArduinoGeneral

Safe operated via bluetooth

userHead Account cancelled 2013-10-18 13:45:08 1781 Views1 Replies
Hey guys I'm using the arduino uno with the BT bee.I'm having problems making my program accept four numbers at the moment it's working fine with one digit.My password is entered via a BT terminal on my phone.Here's what I got so far for the one digit password.

*/

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// serial port
long DATARATE = 38400;  // default data rate for BT Bee

char inChar = 0;
int  LED = 13;  // Pin 13 is connected to a LED on many Arduinos

void setup() {

// set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  Serial.begin(DATARATE);

  // bluetooth bee setup
  Serial.print("\r\n+STWMOD=0\r\n");    // set to slave
  delay(1000);
  Serial.print("\r\n+STNA=DSC\r\n");    // DSC = digital setting circles
  delay(1000);
  Serial.print("\r\n+STAUTO=0\r\n");    // don't permit auto-connect
  delay(1000);
  Serial.print("\r\n+STOAUT=1\r\n");    // existing default
  delay(1000);
  Serial.print("\r\n +STPIN=0000\r\n");  // existing default
  delay(2000);  // required

  // initiate BTBee connection
  Serial.print("\r\n+INQ=1\r\n");
  delay(2000);  // wait for pairing

  pinMode(LED, OUTPUT);
}

void loop() {

lcd.setCursor(0, 1);
  // test app:
  //  wait for character,
  //  a returns message, h=led on, l=led off
  if (Serial.available()) {
    inChar = Serial.read();

    if (inChar == 'a') {
      Serial.print("connected");  // test return connection
    lcd.print("connected!");
    }

    if (inChar == 'h') {
      digitalWrite(LED, HIGH);  // on
   
    lcd.print("LED ON!");}

    if (inChar == 'l') {
      digitalWrite(LED, LOW);    // off
    lcd.print("LED OFF!");
    }

  }

}
2013-10-22 15:44:21 Hello Fossilz,

I'm not entirely sure I understand the problem.
You cannot enter the 4 digit password for the bluetooth module on your phone?

Have you tried setting up the BT once and check whether the configuration remains there after a reboot? I think your program might not need to configure the BT module again and again if you already set it up.

If the problem is on BT terminal, can you share some more information about BT terminal? Do you have a link to this software?

Cheers^^
userHeadPic Jose