Movement data display in Graph and Steps Counter #3833
Replies: 1 comment
-
Posted at 2018-04-06 by @gfwilliams Hi - where do you want to display the graph? On a Web Page? If so, the http://www.espruino.com/Web+Bluetooth+Dashboard page is probably pretty useful. I'm afraid you can't easily get the number of steps though (without adding a separate accelerometer), but you can use the Magnetometer to get a good idea of when the Puck is/isn't moving. To set a password, just use the http://www.espruino.com/Reference#l_E_setPassword command Posted at 2018-04-07 by Pzr0 could you please send me sample of movement function in dashboard and setpassword function also? thanks Posted at 2018-04-09 by @gfwilliams For movement, there's a thread on it here: http://forum.espruino.com/conversations/301185/ Maybe increment a counter based on movement (instead of the Use Posted at 2018-04-09 by Pzr0 Last thing please.. Just want to know how to implement this code http://forum.espruino.com/conversations/301185/ in my web bluetooth dashboard in order to get live graph for every value I get.. Thanks in advance! Posted at 2018-04-10 by @gfwilliams Something like this:
But you then need to remove the whole Posted at 2018-04-10 by Pzr0 Thanks.. Do I have to put the whole piece of code in my connectDevice() function and get the movement value like that? elements.movement.setValue(j.movement); and then display that in my graph because I tried and i saw nothing to be displayed. Sorry for the inconvenience.. Posted at 2018-04-10 by @gfwilliams try just You could stick it in your connectDevice function yes (leaving the Otherwise you could remove the Posted at 2021-08-12 by Yuvika Hi Gordon, Posted at 2021-08-12 by @gfwilliams What device are you doing this on? It might alter how you want to enter the information. But having said that are you doing this for something like a university project? If so I guess the idea was that you figure this out, so apart from giving some pointers I probably can't be too much help! Posted at 2021-08-12 by Yuvika I'm using a puck.js, and it's for a kids coding class Posted at 2021-08-13 by Yuvika My project is due in a few days Posted at 2021-08-13 by @gfwilliams Ok - so where are you supposed to ask the user what the goal is? On a Web Bluetooth website? Or via the Puck itself? If so I guess you're going to have to count the number of times the button is pressed to input the goal - it could make it a bit of a pain to use? Posted at 2021-08-13 by Yuvika On the espruino.web/ide/ website Posted at 2021-08-14 by user133129 hi gordon, I have a project due tomorrow and we are wrapping up, but I see a few issues and wondering if you can help me with it. The first problem i ran into was that if i put a goal higher than 30, the puck thinks that 30 is the goal but the goal is 40 (shown in provided screenshots). On the code it says "if steps 30", then print "congratulations you have reached the goal". When we set the goal i want the if step is 30 and you said 40 in the what is your goal, the 30 should change to 40. Is there any possible way to fix that? Also we want all LEDS to flash, can you give us a easy code for that? Attachments: Posted at 2021-08-15 by Robin Sun 2021.08.15 Hi @user133129 Some thoughts as a suggestion, untested: Replace the constant number 30 with a global variable Follow along with this discussion on how to capture input:
To flash LEDs See examples below heading 'On-board LEDs, Button and GPIO' Posted at 2021-08-15 by Yuvika Replace the constant number 30 with a global variable if(steps == 30) Posted at 2021-08-15 by Robin Is your code block from an existing tutorial? Your var definitions
As the code block did not have line numbers, explaining where to insert code became problematic. As a suggestion, highlight your code in the edit window, then click on the Posted at 2021-08-16 by user133129 Hi, I need to define a variable goal and goal will be given by user input, what function do we use? Posted at 2021-08-16 by @gfwilliams Actually getting user input can be a little tricky, so what I'd say is you get the user to type
Posted at 2021-08-16 by Yuvika Does this code look good? setWatch(function(e) { Posted at 2021-08-16 by Yuvika I'm in the same group as user133129. We are working together Posted at 2021-08-16 by user133129 yeah Posted at 2021-08-16 by user133129 hi robin and gordon, Thanks for the advice as it worked really well. However, I'm still confused for all the LEDS to flash when the goal is reached. We know how to set a timer for how long should all the LEDS flash but we don't know how to make it flash. Before we could used Posted at 2021-08-16 by @gfwilliams I think you're seeing If you want them all to blink the same, it's best just to use the single variable
Posted at 2021-08-16 by user133129 it works thanks Posted at 2021-08-16 by user133129 also thank you robin and gordon for helping us on our project Posted at 2021-08-16 by Yuvika Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-04-05 by Pzr0
Hello Gordon,
I would like to display in graph all the movement data(moving or be still) and also is it possible to count how many steps i do as i walk?? Also i want to put a password for my puck when it's time to connect with it
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions