publiclab / webjack-firmata

A wrapper for WebJack to use as transport layer for firmata.js, for firmata access to an Arduino from a web browser.
https://publiclab.github.io/webjack-firmata/example/
GNU General Public License v3.0
9 stars 4 forks source link

add example which creates gif from spin.media.mit.edu hardware #21

Open jywarren opened 7 years ago

jywarren commented 7 years ago

https://www.webrtc-experiment.com/msr/gif-recorder.html

Spin is a SoftModem-based 360 degree spinning photo table for making gifs: http://spin.media.mit.edu

To make a purely web based version, we could use the above code interspersed with webjack-firmata commands to move the platform. We'd have to add some more timing code though.

Spin easyDriver motor pins are 9 and... 13? Gotta look that up but shouldn't be hard.

jywarren commented 7 years ago

Notes from last night's tests: stepping the stepper is done manually in the Spin Arduino sketch by flipping pin 9 on and off. In JS, we should be able to:

var dir = 1, 
interval = setInterval(function () { 
  Demo.board.digitalWrite(9, dir);
  dir = dir === 0 ? 1 : 0;
}, 300);

But this doesn't seem to be working; perhaps USB power isn't enough for the stepper EasyDriver?

Also -- I found that firmata.js has a stepperStep function:

// Board.prototype.stepperStep = function(deviceNum, direction, steps, speed, accel, decel, callback)

// example use:
Demo.board.stepperStep(2, Demo.board.STEPPER.DIRECTION.CCW, 10000, 2000, function(complete) { console.log('complete'); })