Controlling servomotors using WebAudioAPI #974
Replies: 2 comments
-
Posted at 2018-04-21 by stephaneAG all right, if anyone needs more or less the same hack for servo.move, I have the following code ( not yet tested but worked flawlessly within a browser ;p )
I'll test the above as soon as I can, although not that efficient, it should hopefully do the trick :) On the "web side of things", still no success using the attached code ( "kinda" works .. sometimes .. for some values .. so actually more random that working ;p ), and the tests I could run using Audacity to generate tones were no that concluant :/ .. nb: on a quick try, I also didn't get any signal using the sound card from the pin driven by Espruino "analogWrite" command, even driving it repeatedly ( maybe it needs some amplification ? ) ps: I'm doing stuff on a macbookpro 2K11 ( don't know yet if it means some specific stuff on audio input/output ( .. ) )Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-23 by @gfwilliams With the 45 degree issue, why not use There's some info about controlling Espruino from the sound card at http://www.espruino.com/Headphone - not sure if it helps? If you keep the Espruino connected to USB then you can use that to ensure that signals are being received correctly. To try and decode signals using your sound card, you could also look at https://github.com/espruino/webaudio-oscilloscope - which may be some help to check the signal? ... or have you looked at Web Bluetooth/Puck.js - that'd probably be the most reliable way to get commands out of the browser at the moment as using Web Audio depends on the volume level on your PC (and some PCs/Macs have the signal inverted too!). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-04-20 by stephaneAG
Hi !
I'm currently trying to get some servos working nicely with an original Espruino board ( and also within a chrome browser ).
The overall goal is to have a video & synchronized servo movements ( controlled, if can do so, by the audio channel within the video, or within a "tied" audio file, or on-the-fly-generated signals )
I solved the "45° mystery" thanks to http://forum.espruino.com/conversations/316585/, which now allows me to move each of the servos I have using the following:
Now, I'm looking for a replacement for the servo.move() fcn ( or a tweak of it ) that'd allow me to go to a certain position & taking some time to do so - not sure of what to change, one of my guesses is tweaking the following part ?
On a close subject, I'm also trying to get the same servos to move:
I stumbled on 2 related posts ( http://www.massmind.org/techref/io/servo/wav.htm & https://github.com/pendragon-andyh/WebAudio-PulseOscillator ) which led me to messing around & try stuff, but I didn't achieve ( yet :/ ) my goal of controlling the said servos using purely on-th-fly-generated signals from the WebAudioAPI
Last but not least, I'm aware of the 'ontimeupdate' evt that's available when a video is playing ( & yup, I plan to use it to trigger generating on-the-fly signals sync-ed with the video content )
This being said, here's the code I have so far, I'll be hacking around with it today & the coming days, hopefully coming to a success .. ( .. thanks to hints from here ? ;p )
Thanks in advance for reading this,
Looking forward to reading anything on the subject
ps: test files attached ;)
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions