For this week's assignment I decided to convert my color sensing board I made for the Input device into a lo-fi color document scanner. I mounted my board to the printhead of our 3D printer and started coding the software that would handle everything, inputs from my board, and sending commands to the 3D printer.
The Code is pretty simple. Once I figured out which COM port my board and my 3D printer were on, I could easily send or receive information from both at the same time. Using the seriel library in processing make's the job really easy. Import, declare ports, initialize them then start communicating. My Color Sensing board was already programmed to send RGB values every couple of millis(), so flushing the buffer and parsing the serial data could be achieved quickly in processing. Sending commands to the 3D printer was a little more complex. The baud rate is not in the arduino serial monitor list so I had to do a quick search on the internet to find out at which speed I should speak with it. It ended up being really quick, 250000.
I then setup my document.. a mix of random pieces of paper of different colors just to see if my system worked. The result was not as good as I anticipated.. it seems there's a timing issue with the positionning of the 3D printer and the data read from the sensor. adding a delay somewhere might fix the problem.