stm32f3discovery hc-sr 04 not work

Posted on
  • Hello everyone
    sorry if I do not extend (the English is not my forte)
    not know the cause but the "HC-SR04" does not work with 1.70 or 1.71 espruino 27th Sep in stm32f3discovery. espruino 1.71 significantly improves the fault persists, tested the code and it works in ministm32_32

    Test code

    var sensor = require("HC-SR04").connect(A0,A1,functio­n(dist) {
    console.log(dist+" cm away");
    setInterval(function() {
    sensor.trigger(); // send pulse
    }, 500);

  • When you say it doesn't work, what do you mean?

    Does it give errors? Inaccurate data?

  • does not fail simply does not work ,does not display output

  • Sounds like it's not seeing any response from the HC-SR04.

    setWatch(function(e){console.log(e);},A1­,{repeat:true}); //replace A1 with echo/output pin
    digitalPulse(A0,1,0.01);  //Replace A0 with the trigger (input) pin

    If that displays nothing, it confirms that the part isn't behaving as expected.

    Do you have it connected to 5v tolerant pins, and 5v power? From what I see on the web, the HC-SR04 requires 5 volts.

  • tested the code and the function "SetWatch" does not work in stm32f3discovery

  • There's a bug on GitHub about this:­ues/183

    It was posted in January, 9 months ago. So has setWatch ever worked on the F3 for you?

    Unfortunately the F3 isn't a supported board, so unless you want to try and fix it yourself you'll have to use a different board if you want setWatch. Ideally the Espruino board we provide - the money from those sales means that we can actually afford to test it and make sure that things like this get fixed.

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

stm32f3discovery hc-sr 04 not work

Posted by Avatar for alexrlopez86 @alexrlopez86