- JavaScript 90.7%
- HTML 7.6%
- CSS 1.7%
| scratch-blocks@51634f2ac8 | ||
| scratch-editor@a8bbfd64d6 | ||
| .gitignore | ||
| .gitmodules | ||
| blocklycfg.js | ||
| dist-sens.svg.js | ||
| index.html | ||
| index.js | ||
| motor.svg.js | ||
| package.json | ||
| readme.md | ||
| script.js | ||
| style.css | ||
| wedo-hub.svg.js | ||
WeDo2.0 protocol capable controller
This project is able to control devices using the WeDo2.0 protocol.
Implementation notes
This project uses scratch-blocks, a modified version of google's Blockly by the Scratch foundation, to put together blocks a horizontal layout and the scratch-vm interpreter to execute the code made with the blocks.
Since the scratch-vm interpreter is made for scratch-blocks vertical layout with scratch gui, some modifications are neccessary to the instance of scratch-vm being used.
these include:
- modifying the updateGlows function to glow/unglow individual blocks
- removing all loadExtension* functions to avoid loading a nonexistant wedo extension "requested" by scratch-blocks (to fix saving and loding)
- change the code executed for some blocks to be compatable with my implementation of the WeDo2.0 protocol and getting some parts of the horizontal layout to work
WeDo2.0
The actual WeDo2.0 protocol is relatively simple, there are different characteristics for different types of IO, like reading (charty.sensors),
writing (charty.output), configuring outputs (charty.portDef for writing, charty.portType for getting notifications of new or changing devices),
and the button on the wedo (charty.button, I do not know why this has to be a seperate characteristic)
Most of the communication on writable channels is relatively straightforward, portDef is still a half mystery to me. This project might be a reference