-1

Hey guys I have this Bluetooth shield

enter image description here

Does anybody know how I can get it to connect to Arduino? I can't find any guides on it.

I have this serial program that I want to use to turn on a led. but I can't seem to enter AT mode, or get any indication that besides it connecting to my Mac it's receiving or transmitting any signals.

Anybody got any tips for tutorials/tips for tests for a MAC OSX user?

UPDATE: here is a better foto

enter image description here

I'm trying to run this Arduino code. that uses a 1 to turn a led on and a 0 to turn it off. I want to send these 1's and 0's through a Mac program called Bluterm. I connect it to the HC-05 BUT it doesn't send me anything back. (THE LED IS GREEN, IT'S CONNECTED ON MAC AND ON BLUTERM)

Here is my Arduino code:


int led = 13;
int value = 0;

void setup() {
  Serial.begin(9600);
  pinMode(led, OUTPUT);

}

void loop() {
  if (Serial.available() > 0) {
    value = Serial.read();
    delay(5);

    if (value == '1') {
      digitalWrite(led, HIGH);
      Serial.println("LED IS ON");

    }

    if (value == '0') {
      digitalWrite(led, LOW);
      Serial.println("LED IS OFF");

    }

  }
  }

UPDATE 2: Here is the code from the PDF that was shipped with my shield:



unsigned int timeout=0; unsigned char state=0;
ISR(TIMER2_OVF_vect) {
TCNT2 = 0; timeout++;
if (timeout>61) {
state=1;
timeout=0; }
}
void init_timer2(void) {
//Timer2 Service
TCCR2A |= (1 << WGM21) | (1 << WGM20);
TCCR2B |= 0x07; // by clk/1024
ASSR |= (0<<AS2); // Use internal clock - external clock not used in Arduino
TIMSK2 |= 0x01; TCNT2 = 0; sei();
}
void setup() {
//Timer2 Overflow Interrupt Enable
Serial.begin(9600);
pinMode(2,INPUT); pinMode(13,OUTPUT); attachInterrupt(0,cleantime,FALLING); init_timer2();
}
void loop() {
switch(state) {
case 0:
digitalWrite(13,LOW); break;

case 1: digitalWrite(13,HIGH); Serial.print("Hellow BT"); break;
} }
void cleantime() {
timeout=0;
state=0; }

Anybody can help me decipher this code? none of this looks familiar to me thanks guys,

juriaan

UPDATE 3:

enter image description here

UPDATE 4

enter image description here

  • Comments are not for extended discussion; this conversation has been moved to chat. – Nick Gammon May 16 at 7:09
  • Look, much as I think we would all like to help you, this isn't a forum, where you take post after post to troubleshoot. The intent of the site is to answer specific problems, in such a way that other people may benefit from the answer. If you want to interactively problem-solve the Arduino Forum may be a better fit for you. Just to help you out, someone on the Arduino Forum seems to be asking a similar question. – Nick Gammon May 16 at 7:21
  • Perhaps you could chat with them and work together to find a solution? – Nick Gammon May 16 at 7:25
0

You need to understand the basics before you try running code to "do things":

  1. The shield can run in two modes: AT command mode, which is used to configure it, and Transparent UART mode, which is used to communicate.
  2. Communication with the Arduino is done through UART serial, and the pins used for that communication are selected using the big bank of jumpers.
  3. Nothing will happen until you have configured the shield using AT commands.

To progress you really need the manual for the shield. This should be available from wherever you purchased it. That will detail:

  • What the positions of the jumpers mean
  • What the AT command set of the module is
  • What the baud rate is which you need to use to communicate

And if it's any good:

  • Example code

Once you have at least the first set of those bits of information you can write some software for the Arduino which will pass anything received on Serial through to the bluetooth shield, and anything received from the bluetooth shield back through to Serial. You can then use the serial monitor in the IDE to interact with the shield and configure it in the way you need it.

Once you know how to configure it you can then write some better software for the Arduino that does any startup configuration you need and then operates on the data coming in through Transparent UART mode.

  • The only thing of information I have from them is: hackerstore.nl/PDFs/BTShield.pdf . It tels me about BAUD rate of 9600. But nothing on the usage of the pins, I have mailed the retailer for more information – Juriaan May 15 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.