Member #398680

Member Since: January 15, 2013

Country: United States

  • Tutorial - Bluetooth Mate Silver Retail | about a year ago

    I don’t know if this will help, but I made a sketch that uses this bluetooth module, and LED and an 84x48 lcd. Basically what it does is prints whatever it receives onto the lcd display that I’m using, so I think it might help you. It also turns the LED on when it receives the character ‘h’ and turns it off when it receives the character ‘l’ (lowercase L). Here’s my sketch:

    #include <Adafruit_GFX.h>
    #include <Adafruit_PCD8544.h>
    #include <SoftwareSerial.h>
    
    
    int ledPin = 5;
    
    int bluetoothTx = 2;
    int bluetoothRx = 3;
    
    SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
    
    
    // pin 11 - Serial clock out (SCLK)
    // pin 12 - Serial data out (DIN)
    // pin 10 - Data/Command select (D/C)
    // pin 9 - LCD chip select (CS)
    // pin 8 - LCD reset (RST)
    Adafruit_PCD8544 display = Adafruit_PCD8544(8,9,10,12,11);
    
    void setup()   {
    
      pinMode(ledPin, OUTPUT);
      Serial.begin(9600);
    
      bluetooth.begin(115200);
        display.begin();
      // init done
    
      // you can change the contrast around to adapt the display
      // for the best viewing!
      display.setContrast(50);
      display.clearDisplay();
      display.setTextSize(1);
      display.setTextColor(BLACK);
      display.setCursor(0,0);
      display.println("Setting speed to 11520");
      display.println("Setting speed to 9600");
    
      bluetooth.print("$$$");
      display.println("$$$");
      delay(100);
      bluetooth.println("U,9600,N");
      display.println("U,9600,N");
      bluetooth.begin(9600);
    
    
    
      // text display tests
      display.setTextSize(1);
      display.setTextColor(BLACK);
      display.setCursor(0,0);
      display.display();
      delay(2000);
      display.setTextSize(1);
      display.clearDisplay();
      display.setCursor(0,0);
      display.clearDisplay();
      delay(2000);
      display.display();
    }
    
    
    void loop() {
        //Read from bluetooth and write to usb serial
      if(bluetooth.available())
      {
        char toSend = (char)bluetooth.read();
    
        if (toSend == 'h'){
            digitalWrite(ledPin, HIGH);
        }
    
        if(toSend == 'l'){
            digitalWrite(ledPin, LOW);
        }
        display.print(toSend);
        Serial.print(toSend);
        display.display();
    
      }
    
      //Read from usb serial to bluetooth
      if(Serial.available())
      {
        char toSend = (char)Serial.read();
        bluetooth.print(toSend);
      }
    
    }
    
    void testdrawchar(void) {
      display.setTextSize(1);
      display.setTextColor(BLACK);
      display.setCursor(0,0);
    
      for (uint8_t i=0; i < 168; i++) {
        if (i == '\n') continue;
        display.write(i);
        //if ((i > 0) && (i % 14 == 0))
          //display.println();
      }    
      display.display();
    }
    
  • Product WRL-11049 | about a year ago

    Is it possible to put this into promiscuous mode?

No public wish lists :(