[solved] hc-05 (no data by using jumper-wires)

Posted on
  • Hello,

    I've bought a HC-05 Für Arduino hp and the connection to my Blueterm-App (Android) and also to my Debian-Linux-PC (over Blueman or commandline) were successfull.

    So I wanted to try out the tutorial http://www.espruino.com/Project+7. Instead of soldering the Bluetooth-module to the Espruino-Board, I wanted to plug it in with some jumper wires, as other connections are possible according to http://www.espruino.com/Wiring+Up.

    My connection is:

    HC-05 : Espruino
    GND : GND
    3.3 : 3.3
    TXD : B7
    RXD : B6
    

    My problem is, I can't receive any data over the connection.

    I tried out the following script, I found in the forum:

    function onInit() { Serial1.setup(9600);}
    Serial1.onData(function (e) {  print("--->"+e.data); });
    setInterval(function() {
      Serial1.println("Hello");
    }, 1000);
    

    I would be glad, if somebody could help me!

    Stefan

  • Can you try connecting to A9 and A10? Those are the pins that are suggested in http://www.espruino.com/Wiring+Up - it's the default location for Serial1...

  • Serial1.setup(9600) will not enable Serial1 on pins B7, B6. As Gordon said, Serial1 defaults to being on A9 and A10.

    Serial1.setup(9600,{tx:B6,rx:B7}); should move the serial port to those pins - or you can switch your wires to A9/A10.

  • Hello Gordon and DrAzzy,

    you're great! Both solution work well for me! In fact the "Serial1.setup(9600,{tx:B6,rx:B7}); " solution is more clear for somebody, who don't know the default pins. Perhaps this can be integrated in the http://www.espruino.com/Reference#Serial­ Reference (which I find very useful).

    Many thanks for this quick answer!

    Stefan

  • Nice! Glad it's working.

    You should always specify the pins for uart/i2c/spi/etc before you try to use the interface in question. I think in most cases (certainly in some), the interfaces are not pointed at any pins by default (and/or the pins aren't pointed at the interfaces) until you call setup and specify pins.

  • Hi Stefan, thanks! I'll update the Serial.setup docs to mention default pins.

    Yes, specifying the pins is much easier - however Serial1 is automatically initialised on A9/10, and if there is no USB connection then Espruino automatically moves the 'console' over to it. That means that if you plug the device into a USB charger or a battery, you'll be able to program Espruino wirelessly by bluetooth.

    You can still do that on B6/B7 (with Serial.setup) - it's just that A9/10 is the default and for that, Serial1.setup is not needed at all.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

[solved] hc-05 (no data by using jumper-wires)

Posted by Avatar for Stefan @Stefan

Actions