{"id":11194,"date":"2021-10-07T18:40:36","date_gmt":"2021-10-07T22:40:36","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/?p=11194"},"modified":"2021-10-07T18:40:36","modified_gmt":"2021-10-07T22:40:36","slug":"how-well-can-you-binary","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/how-well-can-you-binary\/","title":{"rendered":"How well can you binary?"},"content":{"rendered":"<p><strong>Project Title: <\/strong>How well can you binary?<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_11196\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11196\" loading=\"lazy\" class=\"wp-image-11196 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-1024x928.jpg\" alt=\"\" width=\"620\" height=\"562\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-1024x928.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-300x272.jpg 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-768x696.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-1536x1392.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-2048x1856.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-973x882.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/setup-copy-508x460.jpg 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11196\" class=\"wp-caption-text\">Basic setup + loading screen<\/p><\/div>\n<p style=\"text-align: center\"><a href=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Normal-test_smol.mov\">Normal test_smol<\/a><\/p>\n<p>Video showing a run through of the piece<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/GOOD-result_smol.mov\">GOOD result_smol<\/a><\/p>\n<p>Video showing a run through of the piece fast enough to be judged as &#8220;good&#8221;<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/AND-fail_smol.mov\">AND fail_smol<\/a><\/p>\n<p>Video showing what happens if you try to press both buttons<\/p>\n<div id=\"attachment_11204\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11204\" loading=\"lazy\" class=\"wp-image-11204 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-1024x684.jpg\" alt=\"\" width=\"620\" height=\"414\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-tested-508x340.jpg 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11204\" class=\"wp-caption-text\">Leah taking the &#8220;How well can you binary?&#8221; test<\/p><\/div>\n<div id=\"attachment_11205\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11205\" loading=\"lazy\" class=\"wp-image-11205 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-1024x697.jpg\" alt=\"\" width=\"620\" height=\"422\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-1024x697.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-300x204.jpg 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-768x523.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-1536x1046.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-2048x1395.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-973x663.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/user-experience-508x346.jpg 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11205\" class=\"wp-caption-text\">User experience<\/p><\/div>\n<div id=\"attachment_11206\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11206\" loading=\"lazy\" class=\"wp-image-11206 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-1024x703.jpg\" alt=\"\" width=\"620\" height=\"426\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-1024x703.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-300x206.jpg 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-768x527.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-1536x1055.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-2048x1406.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-973x668.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/arduino-board-508x349.jpg 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11206\" class=\"wp-caption-text\">Super secret wiring contained in the podium: Arduino connected to buttons and the &#8220;AND&#8221; logic gate breadboard setup.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><b>Simple narrative description<\/b>:<\/p>\n<p>There is a podium with two buttons on it in front of a projection. When the user presses a button the \u201ctest\u201d begins, asking the user to choose between two different options. If the user tries to press both buttons at once a loud buzzer goes off and the projection flashes \u201cAND is not an option.\u201d Each time the user answers a question a ticking noise gets faster. After the last question the test\/projection tells the user if they were \u201cBAD\u201d or \u201cGOOD\u201d based on how fast they were able to answer the questions.<\/p>\n<p><strong>Process Images:<\/strong><\/p>\n<div id=\"attachment_11207\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11207\" loading=\"lazy\" class=\"wp-image-11207 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-1024x573.jpg\" alt=\"\" width=\"620\" height=\"347\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-1024x573.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-300x168.jpg 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-768x430.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-1536x859.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-2048x1146.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-973x544.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210925_170741763-508x284.jpg 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11207\" class=\"wp-caption-text\">Tiny test of the two buttons to arduino setup<\/p><\/div>\n<div id=\"attachment_11208\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11208\" loading=\"lazy\" class=\"wp-image-11208 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-1024x576.jpg\" alt=\"\" width=\"620\" height=\"349\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/PXL_20210929_1936077351-508x286.jpg 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11208\" class=\"wp-caption-text\">Layout of various tasks mid-process<\/p><\/div>\n<div id=\"attachment_11209\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11209\" loading=\"lazy\" class=\"wp-image-11209 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM-951x1024.png\" alt=\"\" width=\"620\" height=\"668\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM-951x1024.png 951w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM-279x300.png 279w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM-768x827.png 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM-973x1048.png 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM-508x547.png 508w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.15.53-PM.png 1400w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11209\" class=\"wp-caption-text\">Early code testing the two button input before adding to main body of code<\/p><\/div>\n<div id=\"attachment_11210\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11210\" loading=\"lazy\" class=\"wp-image-11210 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-1024x648.png\" alt=\"\" width=\"620\" height=\"392\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-1024x648.png 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-300x190.png 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-768x486.png 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-1536x973.png 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-2048x1297.png 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-973x616.png 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.22.36-PM-508x322.png 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11210\" class=\"wp-caption-text\">Figuring out how to add sound<\/p><\/div>\n<div id=\"attachment_11211\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11211\" loading=\"lazy\" class=\"wp-image-11211 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-1024x596.png\" alt=\"\" width=\"620\" height=\"361\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-1024x596.png 1024w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-300x175.png 300w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-768x447.png 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-1536x894.png 1536w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-2048x1192.png 2048w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-973x566.png 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-07-at-5.21.56-PM-508x296.png 508w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11211\" class=\"wp-caption-text\">Adding sound to the basic question setup<\/p><\/div>\n<div id=\"attachment_11212\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-11212\" loading=\"lazy\" class=\"wp-image-11212 size-large\" src=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code-853x1024.jpg\" alt=\"\" width=\"620\" height=\"744\" srcset=\"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code-853x1024.jpg 853w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code-250x300.jpg 250w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code-768x922.jpg 768w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code-973x1168.jpg 973w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code-508x610.jpg 508w, https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-content\/uploads\/2021\/10\/basic-code.jpg 1275w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><p id=\"caption-attachment-11212\" class=\"wp-caption-text\">Testing the code before the buttons arrived using mouse+ keyboard inputs<\/p><\/div>\n<p><b>Process Reflection:\u00a0<\/b><\/p>\n<p>Surprisingly for me the easier aspect of the project was the technical parts. In the past I have struggled the most with the coding and the wiring of the piece but I think I did an okay job giving myself a project that was relatively approachable for someone with my level of experience. It was difficult enough coding-wise where I definitely learned something (I\u2019ve never used Processing before) but not so difficult that I saw it as a major challenge.<\/p>\n<p>I think the biggest hurdle that I had to tackle was conceptual: how do I make sure my piece is meaningful? Or maybe: how do I make sure what I imagined as being \u201cgood\u201d about the project comes through? This, for me, was more of a design problem than anything else.\u00a0 I wanted to make sure the piece had an element of absurdity while still making the message meaningful, and I didn\u2019t know if there was any way to test whether or not I had crossed that line until I actually presented the thing. I think something akin to the 90% critique we are going to have for the next project would have helped me resolve this problem\/these doubts before the final presentation. I think what was interesting to find out during the final critique was how people wanted to explore the piece more in terms of figuring out the different outcomes (ie rushing through the questions to get to the \u201cyou are&#8230;GOOD\u201d outcome) as opposed to focusing on the meaning behind the questions themselves. I wonder if there is some element of the \u201cgame\u201d that could have been changed to focus more thoroughly on the conceptual meaning behind the piece.<\/p>\n<p>Elements such as messing with the question format and making the podium a binary in and of itself, suggestions I received during the critique from our guest critics, definitely might have improved this aspect of the \u201cgame.\u201d In the end I learned that the design of the thing (the appearance of the interface, how it moved between questions, what the podium looked like) for me at least, ended up being the biggest hurdle, and something I needed more feedback on, than the technical problems I expected to struggle with more. In the future I need to focus more on getting the technical stuff out of the way earlier so that I can have people interact with the piece earlier on in order to incorporate design feedback to the functionality of the piece before the final critique.<\/p>\n<p><strong>Arduino Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/*\r\nHow well can you binary?\r\nKirman Hanson\r\n\r\n- The code reads the input coming from the buttons and through the \"AND\" gate circuit (set to the 8,7, and 4 pins on the arduino)\r\nand sends the information to the processing code as either a \"0\", \"2\", \"3\", or \"4\" depending on the input.\r\n\r\n- code is based on the basic \"digital button\" sketch provided with the arduino\r\n\r\n*\/\r\n\r\n\/\/ constants won't change. They're used here to set pin numbers:\r\nconst int leftButtonPin = 8;     \/\/ the number of the left pushbutton pin\r\nconst int rightButtonPin = 7;  \/\/ the number of the right pushbutton pin\r\nconst int andPin = 4;\r\n\r\n\/\/ variables will change:\r\nint leftButtonState = 0;         \/\/ variable for reading the left pushbutton status\r\nint rightButtonState = 0;       \/\/ variable for reading the right pushbutton status\r\nint andState = 0;\r\n\r\n\r\nvoid setup() {\r\n  \/\/ initialize the pushbuttons + AND gate pin as inputs:\r\n  pinMode(leftButtonPin, INPUT);\r\n  pinMode(rightButtonPin, INPUT);\r\n  pinMode (andPin, INPUT);\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop() {\r\n  \/\/ read the state of the pushbutton value:\r\n  leftButtonState = digitalRead(leftButtonPin);\r\n  rightButtonState = digitalRead(rightButtonPin);\r\n  andState = digitalRead(andPin);\r\n\r\n  if (andState == HIGH) {           \/\/ if the and gate is activated...\r\n    Serial.write(3);                \/\/send a 3 to Processing\r\n    Serial.write(0);\r\n    \/\/delay (500);\r\n  \/\/ check if the pushbutton is pressed. If it is, the buttonState is HIGH:\r\n  }\r\n  else if (leftButtonState == HIGH) { \/\/send a 4 to processing if the left button is pressed\r\n    delay(100);                       \/\/ delays help prevent the code from sending out \"double presses\"\r\n    Serial.write(4);\r\n    Serial.write(0);\r\n    \/\/Serial.print(\"left\");           \/\/ these are commented out but used them to test the button input\r\n    \/\/Serial.print(\"off\");\r\n    delay(500);   \r\n  } \r\n  else if (rightButtonState == HIGH) { \/\/ send a 2 to processing if the right button is pressed\r\n    delay(100);\r\n    Serial.write(2);\r\n    Serial.write(0);\r\n    \/\/Serial.print(\"right\");\r\n   \/\/ Serial.print(\"off\");\r\n   delay (500);\r\n    }\r\n  else {\r\n    Serial.write(0);                  \/\/ if nothing is happening send 0 to Processing\r\n  }\r\n   delay(50);                            \/\/ Wait 50 milliseconds<\/pre>\n<p><strong>Processing Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\/*\r\nHow well can you binary?\r\nKirman Hanson\r\nCode draws up the interface for the game\/test of the piece and \r\nit changes the interface in response to the button presses as inputs being\r\nread by the arduino code.\r\n\r\nBasic structure for code is based off the basic \"serial read\" example\r\nthat comes with Processing\r\n\r\nZach + classmates helped with troubleshooting, Erin with the design elements\r\n*\/\r\nimport processing.serial.*;\r\nimport processing.sound.*;\r\nSerial myPort;  \/\/ Create object from Serial class\r\nint buttonVal;      \/\/ Data received from the serial port\r\nPFont f, qFont, andFont, startFont;\r\nStringList qInventory, firstAInventory, secondAInventory;\r\nint qCount = 0;\r\nboolean andTrigger = false;  \/\/ this bool is used to trigger the \"AND\" state (ie the buzzer)\r\nboolean leftHighlight = false;\r\nboolean rightHighlight = false;\r\nboolean buttonPressed = false;\r\nboolean flickerLoad = false;\r\nint warningStart = 100000;\r\nSoundFile ticker, endBeep, endBeep2, wrongNoise;\r\nfloat tickerRate = 2.0;\r\nString tickerFile = \"tick2.0.wav\";\r\nfloat amp = 0;\r\nfloat questionStart;\r\nfloat timeToAnswer;\r\nfloat totalTime;\r\nboolean endStart = false;\r\nfloat endTime;\r\n\r\nvoid setup() {\r\n  \/\/ draws the basic interface\r\n  size(1400,900);\r\n  f = createFont(\"KohinoorDevanagari-Bold\", 40);\r\n  qFont = createFont(\"KohinoorDevanagari-Regular\", 54);\r\n  andFont = createFont(\"KohinoorDevanagari-Bold\", 90);\r\n  startFont = createFont(\"KohinoorDevanagari-Regular\", 30);\r\n  \/\/ all \"inventories\" are string lists containing the questions and\/or answers. Change as you wish.\r\n  qInventory = new StringList(\"The lights are...\", \"It is...\", \"I am...\", \"I am...\",\"The sky is...\", \"I am a student\", \"I am in a ___ mood\", \"I am...\", \"I am only good at...\", \"I am a...\", \"I ___ therefore I am\", \"I am good at making decisions\", \"I am...\", \"Carngie Mellon is...\", \"I am a...\", \"I am...\", \"I am...\", \"I am...\", \"I am...\", \"I am...\");\r\n  firstAInventory = new StringList(\"on\", \"cold\", \"inside\", \"left-handed\", \"up\", \"yes\", \"good\", \"being\", \"art\", \"good person\",\"think\", \"yes\", \"strong\", \"ethical\", \"success\", \"lucky\", \"not fun\", \"spiritual\", \"natural\", \"on\");\r\n  println(firstAInventory.size()); \/\/ helps to diagnose whether you have enough answers for your questions\r\n  secondAInventory = new StringList(\"off\", \"hot\", \"outside\", \"right-handed\", \"down\", \"no\", \"bad\", \"becoming\", \"science\", \"bad person\", \"feel\", \"no\", \"weak\", \"unethical\", \"failure\", \"hard-working\", \"fun\", \"rational\", \"unnatural\", \"off\");\r\n  ticker = new SoundFile(this, tickerFile); \r\n  ticker.loop(1,amp); \/\/ initializes the \"ticking\" noise\r\n  println(qInventory.size()); \r\n  println(secondAInventory.size());\r\n  \/\/ button input\r\n  String portName = Serial.list()[4];\r\n  myPort = new Serial(this, portName, 9600);\r\n}\r\nvoid draw() {\r\n  background(255);\r\n  fill(0);\r\n  textAlign(CENTER);\r\n  \r\n  if ( myPort.available() &gt; 0) {  \/\/ If data is available,\r\n    buttonVal = myPort.read();         \/\/ read it and store it in val\r\n  }\r\n \r\n if (buttonPressed == false){ \/\/ tests whether or not the button has been pressed\r\n     background(255);\r\n     amp = 0; \/\/ if not ticker is silent\r\n  if (buttonVal == 4 || buttonVal == 2){ \/\/gets the interface out of \"start\" mode\r\n    buttonPressed = true;\r\n    println(\"button pressed now true\");\r\n    amp = 0.05; \/\/ ticker is now able to be heard\r\n    }\r\n  else if (second()%2 == 0){ \/\/ sets up the \"start mode\", uses modulus to \"blink\" the text\r\n    fill(0);\r\n    textFont(startFont);\r\n    text(\"How well can you binary?\", width\/2, height*0.333);\r\n    \/\/ every 2 seconds flip the bool in order to create \"flicker\" effect\r\n    if (flickerLoad == false){ \r\n      \/\/println(\"flipped to true\");\r\n      delay(10);\r\n      flickerLoad = true;\r\n      delay(10);\r\n      }\r\n    else if(flickerLoad==true){\r\n    flickerLoad = false;\r\n    }\r\n   }\r\n    else if(flickerLoad == true){\r\n    fill(0);\r\n    textFont(qFont);\r\n    text(\"PRESS ANY BUTTON TO START\", width\/2, height\/2);\r\n  }\r\n} \r\n\r\n  else if (buttonVal == 3) { \/\/ if the arduino sends out a 3,triggers the \"AND\" state\r\n    println(\"and triggered\");\r\n    fill(255);\r\n    warningStart = millis();\r\n    if (millis() - warningStart &lt; 1200){ \/\/only displays for 1.2 seconds\r\n      andTrigger = true;\r\n    \/\/play dramatic tone here\r\n      }\r\n    else {\r\n      andTrigger = false; \/\/ automatically ends after 1.2 seconds\r\n    }\r\n  }\r\n    \r\nelse if ((buttonVal == 4 || buttonVal== 2)&amp;&amp; buttonVal!=3 &amp;&amp; endStart == false) {\r\n    \/\/moves onto next question + triggers end state if we are at the end of the list of questions\r\n    delay(100);\r\n    qCount +=1; \/\/ the q count counts the number of questions answered\r\n    andTrigger = false;\r\n    println(\"tickerRate\", tickerRate);\r\n    if (qCount &lt; qInventory.size()) {\r\n      tickerRateIncrease(buttonVal); \/\/increases the speed of the ticker everytime question is answered\r\n      }\r\n    else { \/\/ triggers the \"end game\" function once at end of the questions\r\n       endTime = millis();\r\n       ticker.stop();\r\n       endBeep = new SoundFile(this, \"endbeep.mp3\");\r\n       endBeep2 = new SoundFile(this, \"endbeep_extra.wav\");\r\n       endBeep.playFor(2.0);\r\n       endStart = true;\r\n       println(\"endStart set to true\");\r\n      }\r\n  }\r\n \r\n  else if (qCount &lt; qInventory.size()) { \/\/displays the different questions so long as there are questions left\r\n    background(255);\r\n    textFont(qFont);\r\n    text(qInventory.get(qCount), width* 0.5, height*0.333);\r\n    textFont(f);\r\n    \/\/set up highlights when button pressed\r\n    if (leftHighlight==true &amp;&amp; millis()- questionStart &lt; 300 &amp;&amp; andTrigger==false){\r\n      println(\"left Highlight\", leftHighlight);\r\n      rectMode(CENTER);\r\n      fill(0);\r\n      rect(width*0.333, height*0.666, 200, 80);\r\n      fill(255);\r\n      text(firstAInventory.get(qCount), width*0.333, height*0.666);\/\/retrieves the correstpodning answer from the list\r\n      println(qCount);\r\n      }\r\n    else if (rightHighlight==true &amp;&amp; millis()- questionStart &lt; 300 &amp;&amp; andTrigger==false){\r\n      println(\"right highlight\", rightHighlight);\r\n      rectMode(CENTER);\r\n      fill(0);\r\n      rect(width*0.666, height*0.666, 200, 80);\r\n      fill(255);\r\n      text(secondAInventory.get(qCount), width*0.666, height*0.666);\/\/retrieves the correstpodning answer from the list\r\n      println(qCount);\r\n      } \r\n     else{\r\n       \/\/ \"normal\" question display\r\n       fill(0);\r\n       text(secondAInventory.get(qCount), width*0.666, height*0.666);\r\n       text(firstAInventory.get(qCount), width*0.333, height*0.666);\r\n       \/\/if neither is picked don't highlight it\r\n       rightHighlight = false; \r\n       leftHighlight = false;\r\n     }\r\n    }\r\n  \/\/ this function sets up the \"AND\" state\r\n  if (millis() - warningStart &lt; 1200 &amp;&amp; andTrigger==true){\r\n        wrongNoise = new SoundFile(this, \"wrong.wav\");\r\n        wrongNoise.play();\r\n        delay(90);\r\n        fill(255,0,0);\r\n        background(255);\r\n        textFont(andFont);\r\n        text(\"AND is not an option\", width\/2, height\/2);\r\n      }  \r\n  \/\/ this sequence is the end state\r\n  if (endStart == true){\r\n    println(\"end state\");\r\n    ticker.stop();\r\n\r\n    if (endStart==true &amp;&amp; millis()-endTime &lt; 2500){\r\n      println(\"end game displayed\");\r\n      textFont(andFont);\r\n      text(\"END GAME\", width\/2, height\/2);\r\n      println(\"endTime\", endTime);\r\n      println(\"endStart\", endStart);\r\n      println(\"millis-endTime\", millis()-endTime);\r\n      println(\"millis\", millis());\r\n    }\r\n    if (millis()-endTime &lt; 8000 &amp;&amp; millis()-endTime &gt;= 2500){\r\n      println(\"calculating score displayed\");\r\n      textFont(qFont);\r\n      text(\"Calculating results...\", width\/2, height\/2);\r\n    }\r\n    if (endStart==true &amp;&amp; millis()-endTime &lt; 10000 &amp;&amp; millis()-endTime &gt;= 8000){\r\n      println(\"you are...\");\r\n      textFont(qFont);\r\n      text(\"You are...\", width\/2, height\/2);\r\n    }\r\n    if (endStart==true &amp;&amp; millis()-endTime &lt; 12000 &amp;&amp; millis()-endTime &gt;= 10000 &amp;&amp; totalTime &lt;= 30000){\r\n      textFont(andFont);\r\n      background(0,255,0);\r\n      fill(255);\r\n      text(\"GOOD\", width\/2, height\/2);\r\n    }\r\n    if (endStart==true &amp;&amp; millis()-endTime &lt; 12000 &amp;&amp; millis()-endTime &gt;= 10000 &amp;&amp; totalTime &gt; 30000){\r\n      textFont(andFont);\r\n      background(255,0,0);\r\n      text(\"BAD\", width\/2, height\/2);\r\n    }\r\n    if(endStart == true &amp;&amp; millis()-endTime &gt;= 14000){\r\n      println(\"went to no loop\");\r\n      println(endTime);\r\n      text(\"\", width\/2, height\/2);\r\n      fill(0);\r\n      noLoop();\r\n    }\r\n  }\r\n }\r\nvoid tickerRateIncrease(int buttonVal) { \/\/this function controls the ticker rate\r\n      println(\"click\");\r\n     if (buttonVal == 4){\r\n       leftHighlight = true;\r\n     }\r\n     if (buttonVal== 2){\r\n       rightHighlight = true;\r\n     }\r\n     \/\/increase rate + loudness\r\n     tickerRate -= 0.1;\r\n     amp += 0.05;\r\n     \/\/ endstate calculations\r\n     timeToAnswer = millis() - questionStart;\r\n     totalTime += timeToAnswer;\r\n     questionStart = millis();\r\n     \/\/changing rates\r\n     String rateString = nf(tickerRate, 1, 1);\r\n     println(\"new ticker rate\", tickerRate);\r\n     String[] tickerParts = new String[3]; \r\n        tickerParts[0] = \"tick\"; \r\n        tickerParts[1] = rateString; \r\n        tickerParts[2] = \".wav\"; \r\n     String tickerFile = join(tickerParts, \"\"); \/\/sets up new ticker file name to be retrieved\r\n    ticker.stop();\r\n    ticker = new SoundFile(this, tickerFile);\r\n    ticker.cue(0.3);\r\n    ticker.loop(1,amp);\/\/plays new, faster, ticker file\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Title: How well can you binary? &nbsp; Normal test_smol Video showing a run through of the piece GOOD result_smol Video showing a run through of the piece&#8230;<\/p>\n","protected":false},"author":129,"featured_media":11195,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[185,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/posts\/11194"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/users\/129"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/comments?post=11194"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/posts\/11194\/revisions"}],"predecessor-version":[{"id":11213,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/posts\/11194\/revisions\/11213"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/media\/11195"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/media?parent=11194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/categories?post=11194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/62-362\/f2021\/wp-json\/wp\/v2\/tags?post=11194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}