Using Arduino wireless Bluetooth Programmer shield

I am newbie to Arduino programming. I got a

I managed to connect and program the LED screen to show whatever text I want to show in that through Arduino.

I am struggling to use the Wireless shield. I am able to find a way to communicate with it from an Android device.

  • Is the shield only to program wirelessly? Can't I use it communicate with the Arduino from an app
  • I modified and implemented a sample android app, and the text I am sending from the Android app is being shown in the console output. But I am not able able to pick it up from the program

Whenever I try this

btSerial = new SoftwareSerial(rxPin, txPin);
if(btSerial->available())
   btSerial->read();

The arduino just resets (setup() gets called).

I have not clue what I am doing wrong. Can anybody help? I can't see any samples/docs on the wireless shield I am using.

Just to add to the previous question, whenever I send AT commands, like

btSerial.write("AT+VERSION");

I don't get any response on the console (even btSerial.available() is not true)

codevalley: I have not clue what I am doing wrong.

We can not even see your code, how could we help?

By looking into a crystal ball?

If you post your complete code, please use code tags.

#include <avr/pgmspace.h>
#include <SoftwareSerial.h>
#include "bluetooth.h"

Bluetooth *blue = new Bluetooth("Robokits_ArduBluetooth");

int RESET = 7;
char inChar;

// Connections to board
const byte latchPin=8;
const byte clockPin=12;
const byte data_R1=10;
const byte data_R2=11;
const byte en_74138=2;
const byte la_74138=3;
const byte lb_74138=4;
const byte lc_74138=5;
const byte ld_74138=6;
byte ScanRow = 0;
unsigned long counter;

//Insert message here ("message ")
char message[140] = "abcd";


byte buffer[256] = { //truncated array to post here.
};
// ---------------------------------------------------------------------------------------------------
// FONTS sourced from various locations on the internet
// full ASCII character set (8x16) (1520 bytes)
const uint8_t font8x16_basic[] PROGMEM = { //truncated array to post here.
};
// Routine to print a single character in one of 8 columns
// Inputs:
// x is one of (0,16,24,32,40,48,56), 
// y (0 to 16 or 24 depending upon font size),
// n is either (0 to 9) or an ascii value, 
// font=0 for big font, 2 for small font, 
// inverse is true for an inverted character
void drawChar(uint16_t x, uint16_t y, byte n, byte font, boolean inverse) { 
    byte charbytes[16], fontrows, xover8 = x>>3; 
    int index;
    if (0 != (x % 8)) return;    // x not a multiple of 8
    if ((n>9) && (n<32)) return; // invalid character
    if (font==0) fontrows=16; else fontrows=8;
    if ((n>=0) && (n<=9)) index=(n+16)*fontrows; else index=(n-32)*fontrows; // go to the right code for this character

// addressing start at buffer and add y (rows) * (WIDTH is 64 so WIDTH/8) is 8 plus (x / 8) is 0 to 7
    byte *pDst = buffer + (y << 3) + xover8;
    for (byte i=0;i<fontrows;i++) {  // fill up the charbytes array with the right bits
      if (font==0) charbytes[i] = pgm_read_byte(&(font8x16_basic[index+i]));
      // reverse bit order for fonts 0 and 1
      if (font != 0) {
        charbytes[i] = (charbytes[i] & 0xF0) >> 4 | (charbytes[i] & 0x0F) << 4;
        charbytes[i] = (charbytes[i] & 0xCC) >> 2 | (charbytes[i] & 0x33) << 2;
        charbytes[i] = (charbytes[i] & 0xAA) >> 1 | (charbytes[i] & 0x55) << 1;
      };
      if (inverse) charbytes[i] = ~charbytes[i];
      };
    const byte *pSrc = charbytes; // point at the first set of 8 pixels    
    for (byte i=0; i<fontrows; i++) {
        *pDst = *pSrc;     // populate the destination byte
        pDst += 8;         // go to next row on buffer
        pSrc++;            // go to next set of 8 pixels in character
    }
};

void moveLeft(byte pixels, byte rowstart, byte rowstop) { // routine to move certain rows on the screen "pixels" pixels to the left
byte row, column; 
short unsigned int address;
  for (column=0;column<8;column++) { 
    for (row=rowstart;row<rowstop;row++) {
      address = (row<<3) + column; /// right here!
      if (column==7) 
         buffer[address] = buffer[address]<<pixels; // shuffle pixels left on last column and fill with a blank
        else {                // shuffle pixels left and add leftmost pixels from next column
         byte incomingchar = buffer[address+1];
         buffer[address] = buffer[address]<<pixels;
         for (byte x=0;x<pixels;x++) { buffer[address] += ((incomingchar & (128>>x)) >> (7-x))<<(pixels-x-1); };
         }
     }
  }
};



void shiftOut(byte row) { // fast routine to shove out 8 columns into two rows via board's shift registers
  for(byte column=0;column<8;column++) {
    byte index = column + (row<<3);  
    for(byte i=0;i<8;i++) {    
      PORTB &=~(3<<(data_R1-8));                                 // data_R2 is LOW; data_R1 is LOW;
      PORTB &=~(1<<(clockPin-8));                                // digitalWrite(clockPin,LOW);
      PORTB |= !((buffer[index]>>(7-i)) & 0x01) << (data_R1-8);  // top set of rows
      PORTB |= !((buffer[index+128]>>(7-i)) & 0x01) << (data_R2-8); // bottom set of rows
      PORTB |= 1<<(clockPin-8);                                  // digitalWrite(clockPin,HIGH);
    };
  };
};

ISR(TIMER2_COMPA_vect){  
     cli();
     digitalWrite(en_74138, HIGH);     // Turn off display
     shiftOut(ScanRow);                // Shift out 8 columns
     digitalWrite(latchPin, LOW);
     digitalWrite(latchPin, HIGH);
     PORTD = (ScanRow << 3) | (PORTD & 0X87); // Highlight row: pins 3 4 5 6 (la_74138 lb_74138 lc_74138 ld_74138)
     digitalWrite(en_74138, LOW);     // Turn on display
     ScanRow++;                       // Do the next pair of rows next time this routine is called
     if (ScanRow==16) ScanRow=0;
     sei();
};

void setup() {
                     // declare the LED and BT RESET pins as output
  pinMode(RESET,OUTPUT);  
  Serial.begin(115200);
  pinMode(13, OUTPUT);
  
// Set up Timer2 as the scanning interrupt timer
  cli(); // clear interrupts
  TCCR2A = 0; TCCR2B = 0; TCNT2  = 0;
  TCCR2B |= (1 << CS12) | (1 << CS10);     // Set 1024 prescaler
               // 160Hz scan rate = 10 frames/second (16 pairs of rows)
  OCR2A = 97;  // 97 = (16,000,000 / (1024*160)) - 1
  TCCR2A |= (1 << WGM21); TIMSK2 |= (1 << OCIE2A);
  
  pinMode(latchPin,OUTPUT);  pinMode(clockPin,OUTPUT);
  pinMode(data_R1,OUTPUT);   pinMode(data_R2,OUTPUT);
    
  pinMode(en_74138,OUTPUT);
  pinMode(la_74138,OUTPUT);  pinMode(lb_74138,OUTPUT);
  pinMode(lc_74138,OUTPUT);  pinMode(ld_74138,OUTPUT);
  
  digitalWrite(en_74138, LOW);
  digitalWrite(data_R1, HIGH); digitalWrite(data_R2, HIGH);
  counter = millis();
  sei(); //allow interrupts
  blue->setupBluetooth();
  Serial.println("Finished setup"); 
}

void loop() {
  
  static int count=0;
  String msg = blue->Read();

  char charBuf[50];
  if(msg.length() > 1){
    msg.toCharArray(charBuf, msg.length()) ;
  }
  // display next character of message
  drawChar(56,16,charBuf[count%(sizeof(charBuf)-1)],0,false);
    count = (count + 1);
    // move the text 7 pixels (not 8 because it looks better) to the left
    for (byte i=0; i<4; i++) {
       delay(80);
       moveLeft(2,1,32);
    };

};

Bluetooth.h and Bluetooth.cpp are from the github code.

@Whandall: Actually, I posted the relevant code above. Those lines are enough to reproduce my reboot, but since you asked, I am posting the whole program.
The basic query I have is, I couldn’t find any guide on how to interface the above mentioned wireless board.