What can I do ?

Posted on
  • Hey,

    I am wondering if I am not going to ask some stupid questions and the answers will be : RTFM !
    But anyway,

    • Is there a light and battery event ? Like the mag one. I was wondering if I could trigger functions based on a light event, for instance, without having to use setInterval().
    • Can I open an (android) app with the puck ? Using the button (or anything else)
    • Do you think it will be possible to control spotify (as an example) on the a phone ? Button to open Spotify, magnetometer to control the volume, etc...

    That's it i guess,
    Thanks all (especially Gordon !)

  • Not stupid questions at all :)

    Is there a light and battery event ?

    Afraid not. The magnetometer event is there because the magnetometer itself can wake the Puck up when something happens, so it makes sense.

    For the light and battery it can't, so there's no real benefit in it being built in - you might as well just do: setInterval(function() { myFunction(Puck.light()) }, 10000);

    Can I open an (android) app with the puck ?

    Yes - you could turn the Puck into a HID keyboard and could then either send key presses you wanted to use to open an app (like 'search', a name, then 'enter), or you could set up a keyboard shortcut with something like: http://www.howtogeek.com/175267/the-htg-guide-to-using-a-bluetooth-keyboard-with-your-android-device/

    Info on Puck.js keyboards here: http://www.espruino.com/Puck.js+Keyboard

    There's also the ability to turn the Puck's NFC on and direct the phone to a URL if you're close enough.

    Otherwise you might have to make your own app, and then you can do pretty much anything in response to a button press. DroidScript might help you there.

    Do you think it will be possible to control spotify (as an example) on the a phone ?

    Yes - you can use the 'multimedia keys' here: http://www.espruino.com/Puck.js+Keyboard

    That'd do volume, tracks, and play/pause - and potentially if you could set Spotify as your default music player, hitting 'play' might auto-start it? Either that or you might be able to find an app that would auto-start spotify based on the Play key being pressed.

  • light event

    For light events, take a look at dtdv detector.

    If you wanted to go further with light change detection, an sensitive and low power consuming op amp in diff and integration circuitry could do be added to trip a setWatch()-ed pin.

  • ah I understand now, so yes it makes sense !

    Thanks both for the links, I'll have a look (and keep you posted if I do something incredible :-))

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

What can I do ?

Posted by Avatar for flo @flo

Actions