Avatar for Radar

Radar

Member since May 2014 • Last active Aug 2016
  • 2 conversations
  • 4 comments

Most recent activity

  • in Interfacing
    Avatar for Radar

    Thanks for the comments. I've already got an ADXL345 connected, but I guess its a bit chicken and egg - without knowing what the peaks and background levels are it can be difficult to know what thresholds to set for the interrupts and filters.

    I'll carry on having a look through the datasheets, (and do it in a more methodical way) keeping my fingers crossed.

    I'm hoping to avoid the need to put together more circuitry, I'm more of a programmer than electronics person.

    • 4 comments
    • 1,939 views
  • in Interfacing
    Avatar for Radar

    I'm looking at using an accelerometer to measure the peak or maximum acceleration (deceleration) in a given period of time. I'm wondering if anyone has any better ideas than I currently have. As I see it I am going to have to get the Espruino to read the acceleration at a high frequency.

    -Is there a better way of doing this that doesn't involve lots of cpu cycles?
    -Does anyone know if there are alternative accelerometers that might store this value? (I've started looking at datasheets, but haven't uncovered one yet)

    I'm happy to do some leg work and/or submit any necessary extra modules, I just haven't found an approach I feel is right yet.

  • in JavaScript
    Avatar for Radar

    Thanks, after doing both steps it's all working as expected now.

    For my own sanity I also tried putting my own resistor between C1 and ground instead of the internal own - probably unsurprising that works as well.

    With the benefit of hindsight I can see how the solution works, but I'm a little confused as to where the signal float is coming from. Is this to do with the quality of the switch or just the way of the world and something I'll learn to live with?

    Thanks again

  • in JavaScript
    Avatar for Radar

    I've finally started playing with my Espruino, going through a few of the tutorials and trying a few things out.
    I'm having trouble replicating the BTN1 functionality on a external/extra button. I've connected a press button between pin C1 and 3.3v and my test code is

    function onInit() { 
    pinMode(C1, "input");
     }
    
     function buttonPressWatcher(e) {
        console.log("pressed!" + e.time); 
    }
    
    function buttonReleaseWatcher(e) {  
        console.log("Release!" + e.time); 
    }
    
    setWatch(buttonPressWatcher, C1, { repeat: true, edge: "rising", debounce:100}); 
    //setWatch(buttonReleaseWatcher, C1, { repeat: true, edge: "falling"}); 
    setWatch(buttonReleaseWatcher, C1, { repeat: true, edge: "falling", debounce:100}); 
    
    setWatch(buttonPressWatcher, BTN1, { repeat: true, edge: "rising", debounce:100});
    //setWatch(buttonReleaseWatcher, BTN1, { repeat: true, edge: "falling"}); 
    setWatch(buttonReleaseWatcher, BTN1, { repeat: true, edge: "falling", debounce:100});
    
    

    A press and release of BTN1 results in the logging of a press and release. A press of the button on C1 only results in the logging of the press.
    If I take the debounce parameter off the C1 setwatch command, I get a continual stream of "Release!" log messages.
    Any hints as to what I'm missing would be appreciated

Actions