Mods

mods

site

mods

run mods locally(Niel’s version)

mods

community edition

mods

what I did

node.js

$ node -v
v9.4.0

http-server

$ sudo npm install http-server -g

clone mods repo

$ cd Desktop
$ git clone https://github.com/fabfoundation/mods.git

ws and serialport

$ cd mods/js
$ npm install ws
$ npm install serialport

Connect MDX-20 and find port

$ ls /dev | grep usb
tty.usbserial-A102ORFS

now the port is /dev/tty.usbserial-A102ORFS

start webserver
Open new terminal window

$ cd
$ Desktop/mods
$ hs
tarting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://192.168.199.126:8080
Hit CTRL-C to stop the server

open Chrome tab and run index.html

127.0.0.1:8080

setup serialserver.py
Open new terminal window

$ python3 --version
Python 3.7.6
$ pip3 --version
-bash: pip3: command not found
$ brew install python3
Updating Homebrew...
$ brew info python3
python: stable 3.7.6 (bottled), HEAD
$ which python3
/usr/local/bin/python3
$ brew postinstall python3
$ pip3 --version
pip 19.3.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
$ cd Desktop/mods/py
$ ls
serialserver.py
$ python3 serialserver.py 127.0.0.1 1234
Traceback (most recent call last):
  File "serialserver.py", line 18, in <module>
    import sys,serial,asyncio,websockets,json
ModuleNotFoundError: No module named 'serial'
$ pip3 install pyserial
Collecting pyserial
$ python3 serialserver.py 127.0.0.1 1234
Traceback (most recent call last):
  File "serialserver.py", line 18, in <module>
    import sys,serial,asyncio,websockets,json
ModuleNotFoundError: No module named 'websockets'
$ pip3 install websockets
Collecting websockets
$ python3 serialserver.py 127.0.0.1 1234

now working serialserver

add WebSoket Python serial Module on mods(Chrome)
right click > modules > open servermodules > 3 socker > server > serialpy Connect Roland MDX-20 Milling Machie Modules > outputs > file to Inputs > file(object)

On WebSocket Python serial adress:127.0.0.1
port:1234
serialserver.py > open

serial device port: /dev/tty.usbserial-A102ORFS
baund rate:9600
flow control: DSRDTR

RTSCTS: blue cable
DSRDTR: black cable

“calculate” on mill raster 2D Modules then “send file” on WebSoket Python serial Module

serialserver.py said

open /dev/tty.usbserial-A102ORFS at 9600 with none
connection accepted from 127.0.0.1
send file
P
Error in connection handler
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/websockets/server.py", line 191, in handler
    await self.ws_handler(self, path)
  File "serialserver.py", line 108, in receive
    s.write(c)
  File "/usr/local/lib/python3.7/site-packages/serial/serialposix.py", line 532, in write
    d = to_bytes(data)
  File "/usr/local/lib/python3.7/site-packages/serial/serialutil.py", line 63, in to_bytes
    raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: 'P'

open serialserver.py in editter and chage line 88

s.write()

s.write(c.encode()) this is Kris’s repo