Week 14. Machine design: Stylus profilometer

In other words, our goal was for axes to change their motions in response to user inputs dynamically, rather for axes to ignore user inputs while executing toolpaths statically. We aimed to use the dynamic control to make a profilometer. In particular, we connected button to the computer via a serial port. a machine that moves a button along a Z axis until it touchs

Used the program fabnet_xyaxes.py to ran 2 axes, from the Terminal with the command python fabnet_xyaxes.py [[[X1,Y1],[X2,Y2],...]]. Copied the programs term.py, hello.light.45.py, and hello.reflect.45.py to the folder that contains the mods examples. Attached the button via FTDI cable, and checked its device name /dev/tty.usbserial-FT9L3BOZ. Confirmed that the button works, can see dududu when pressing the button. Copied fabnet_xyaxes.py and renamed to fabnet_xyaxes_button.py. Looked at term.py to figure out which parts to integrate into fabnet_xyaxes.py. Within mods, can detect the button press using the WebSocket serial module using Neil's program serialserver.js by running from the Terminal node serialserver.js 127.0.0.1 1234. He has a line mod.socket.onmessage = function(event) {mod.status.value = event.data ...} Decided to adjust term.py to output a different value when d and u pressed. Changed line 76 from widget_text.insert(INSERT,byte) to widget_text.insert(INSERT,byte+1) and got the error TypeError: cannot concatenate 'str' and 'int' objects. Then changed to widget_text.insert(INSERT,byte+"1") This gave the result d1u1d1u1 very cool! So then changed to To close the program without a bug, control + C the Terminal and then click the top of the Python window. It may quit. If not, click the Python window and it may quit. If not, click the red circle and it should quit. At first did not work, the bugs may have been the wrong notation for if (did not have parentheses) and indentation errors (rather than use tab, used three spaces to match the rest of Neil's code). The modification is here: I changed widget_text.insert(INSERT,byte) to if (byte == "d"): widget_text.insert(INSERT,"Button down\n") elif (byte == "u"): widget_text.insert(INSERT,"Button up\n") else: widget_text.insert(INSERT,byte) Now, I need to change the "Button down" etc commands to fabnet commands. So added this code to each block widget_text.insert(INSERT,"Button down\n") for move in moves_down: stages.move(move, 0) status = stages.xAxisNode.spinStatusRequest() # This checks to see if the move is done. while status['stepsRemaining'] > 0: time.sleep(0.001) status = stages.xAxisNode.spinStatusRequest Got another indentation error. This was from the bottom bit! Which is no longer relevant.