Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Need help with arduino BlueTooth coding

Need help with arduino BlueTooth coding

Scheduled Pinned Locked Moved Development
1 Posts 1 Posters 665 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Martin TellblomM Offline
    Martin TellblomM Offline
    Martin Tellblom
    wrote on last edited by
    #1

    Trying to build a Mysensors BlueTooth sensor, but I can't get it to work.
    I have a HM-17 cypress adapter and when i using th SoftwareSerial library I can get the simplest things going

    For example I get the HW-Address when typing AT+ADDR?, the baudrate AT+BAUD? and so on.

    When setting it in the mode for scanning, using AT+IMME1 and AT+ROLE1 and then start scanning using AT+DISC? I only get this answers:

    OK
    OK+Set:1
    OK+Set:1
    OK+DISCS
    OK+DISCE
    

    Between OK+DISCS and OK+DISKE there should be around 5 devices listed and after this everything just stops. No reaction to anymore commands.

    The sketch I'm using is this:

    #include <SoftwareSerial.h>  
    
    int bluetoothTx = 3;  // TX-O pin of bluetooth 
    int bluetoothRx = 4;  // RX-I pin of bluetooth
    
    SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
    
    void setup()
    {
      Serial.begin(9600);  // Begin the serial monitor at 9600bps
    
      bluetooth.begin(9600);  // The Bluetooth Mate defaults to 115200bps
      bluetooth.print("$");  // Print three times individually
      bluetooth.print("$");
      bluetooth.print("$");  // Enter command mode
      delay(100);  //
      bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity
      Serial.println("U,9600,N");
      // 115200 can be too fast at times for NewSoftSerial to relay the data reliably
      bluetooth.begin(9600);  // Start bluetooth serial at 9600
    }
    
    
    void loop()
    {
      if(bluetooth.available())  // If the bluetooth sent any characters
      {
        // Send any characters the bluetooth prints to the serial monitor
        Serial.print((char)bluetooth.read());  
      }
      if(Serial.available())  // If stuff was typed in the serial monitor
      {
        // Send any characters the Serial monitor prints to the bluetooth
        bluetooth.print((char)Serial.read());
      }
      // and loop forever and ever!
    }
    

    Anyone here that is good at this and could get me a hint?

    MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    27

    Online

    11.7k

    Users

    11.2k

    Topics

    113.1k

    Posts


    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular