Recitation 8

Some reflections:

1. In the first version we found we can only draw dots instead of lines, because we used the point function. Ideally it could be correct (if we have large frame rate), yet low frame rate will give us discrete dots. Therefore I changed the point(x, y) to line(x, y, px, py), where we should define a pair of variable px, py to remember the previous location of our “pen”.

2. At first there are always weird “10” s messed in the correct coordination. For example, the correct sequence should be (in strong format): 0, 0, 15, 16, 50, 60… but 10 appears in the middle: 0, 0, 10, 15, 16, 10, 50, 60, 10……
After research we realized it is because we did not complete understand what is behind write() and print(). We understood before that print sends out string and write sends out bytes, but since I knew serial communication cannot really “sends string”, it is still in form of bytes. I knew later the 10 came from “\0” but I still didn’t know the real problem, so I researched online:

https://arduino.stackexchange.com/questions/10088/what-is-the-difference-between-serial-write-and-serial-print-and-when-are-they
https://www.instructables.com/id/Arduino-Function-Serialread-And-SerialreadString/

The problem is that: it is ok to send bytes, but since the sample code uses “\0” and comma to separate the data, we should use the ASCII of \0 and comma to do the separation, if we are reading bytes as well. On the other hand, if we read as string, we need to convert the numbers in string back to ASCII for correct coordinates.

As for the Interaction, I thought of our final design: we have a similar problem actually, this using-rotation-to-draw-stuff machine is quite hard to operate, that’s why in the video there are only random lines. The same is with our final, so we need to improve that.

Leave a Reply