# Etching and Sketching and POSTing and GETing

Spring 2019

The questions below are due on Sunday February 24, 2019; 11:59:00 PM.

You are not logged in.

Note that this link will take you to an external site (https://oidc.mit.edu) to authenticate, and then you will be redirected back to this page.

## 1) Overview

In this Design Exercise, you will use the IMU's accelerometer integrated with the rolling-ball infrastructure from Week 02's regular exercises as well as the IMU integration of Week 03's regular exercises to create an etch-a-sketch which allows POSTING of drawings. Essentially we want you to create a drawing by logging/remembering/displaying your rolling ball's position as you roll it around the screen using your IMU.

## 2) Specs

• The system must be capable of:
• Creating drawings using a 4-pixel wide "ball" serving as a drawing tip.
• Recording the drawings at a time-resolution you deem fit (do you remember every point position or every other, etc...?)
• Completely erasing and starting over at any point during a drawing sequence
• POSTing the drawing to the drawing application URL at any point during the draw.
• Retrieving a specific drawing from the server using a GET request and then displaying that drawing
• It can use at most two buttons (how you use them is up to you)

The drawing should be stored as x-y coordinates using commas to separate the x,y value and ampersands (&) to separate the coordinates like the following: Say your drawing was composed of the ball being in three locations :(0,4), (15,15), and (14,11). You'd want to send that up to the server in the following format:

0,4&15,15&14,11


A web application located at http://608dev.net/sandbox/etchsketch is configured such that when you send a properly formatted POST (note this one is json formatted):

POST /sandbox/etchsketch HTTP/1.1
Host: 608dev.net
Content-Type: application/json
Content-Length: 47

{"user":"jodalyst","drawing":"0,4&15,15&14,11"}


it will store the drawing data using a unique identifying number which it returns to you in the body of the POST response in the format:

drawing ID:151917766919


where 151917766919 or whatever number you get should be remembered. If you do a GET request with a query argument for the drawing ID then, you can recover your drawing from the database:

GET /sandbox/etchsketch?drawing_id=151917767559 HTTP/1.1
Host: 608dev.net



which will return:

drawing~0,4&15,15&14,11


The drawing POSTed can be no longer that 2000 characters.

Small Modification to Spec from Tuesday Evening: Please use only buttons connected to pins 16 and 5!!!

Any late factors are based on the timestamp for the last time that the URL is entered on the page or when the code is uploaded or when a comment is added/changed. If you change your URL after the deadline you will incur a late penalty. If you upload code after the deadline, you will incur a late penalty. If you comment after the deadline, you will incur a late penalty. One-Week Extensions DO NOT APPLY Design Exercises.

You must upload all code that you used in your design. Failure to upload code will result in signifcant point loss. This includes if you just forgot. Screenshots of your file's last modified date in My Computer are not evidence that the file has not been changed. They must be uploaded.

Problem Status:
A Python Error Occurred:

Error on line 2 of python tag (line 76 of file /S19/ex03/etch_sketch_send_retrieve):



Enter the url for the video

No file selected

Enter any comments you may want us to know about. For example, if you started this exercise but don't want it graded, make a note here. Please hit submit on this question even if you don't have any comments.

This problem will not be marked as done (100) until graded by the staff. If you have filled it out, it will appear as with a note saying "Work Submitted" on the main ex03 page.

This page was last updated on Sunday March 10, 2019 at 03:42:51 PM (revision 2aaaaf2).