{"id":5148,"date":"2021-12-01T00:01:24","date_gmt":"2021-12-01T05:01:24","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?p=5148"},"modified":"2021-12-01T13:47:10","modified_gmt":"2021-12-01T18:47:10","slug":"eyedrop-attack","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/2021\/12\/01\/eyedrop-attack\/","title":{"rendered":"eyeDrop Attack!"},"content":{"rendered":"\n<p>Team: <strong>Micheal Nguyen and Jason Perez<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"2268\" height=\"2266\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited.jpg\" alt=\"\" class=\"wp-image-5166\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited.jpg 2268w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-300x300.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-1024x1024.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-150x150.jpg 150w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-768x767.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-1536x1536.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-2048x2046.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-88x88.jpg 88w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-973x972.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/PXL_20211123_211649046-edited-508x508.jpg 508w\" sizes=\"(max-width: 2268px) 100vw, 2268px\" \/><\/figure>\n\n\n\n<h2>Abstract<\/h2>\n\n\n\n<p class=\"has-text-align-left\">Our goal was to create an interactive game where a user could use marble projectiles to shoot at targets and score points, in an engaging or addictive fashion. eyeDrop Attack is an engaging, on-the-floor game that allows players to drop, throw or otherwise launch a marble projectile at any of the six eyes of the monster. Players score points based on how long the \u201ceyes\u201d or limit switches are pressed, which incentivizes strategies that target multiple eyes or target a single eye for a continuous period of time.<\/p>\n\n\n\n<h2>Objectives<\/h2>\n\n\n\n<p>While our original goal was to create an arcade-style shooter which uses a horizontal launch trajectory to target multiple vertical targets, we ended up simplifying our vision to a top-to-bottom or horizontal target surface, to improve the feasibility of the project. By simplifying our project we were able to focus our efforts and achieve a functional marble return system, LCD text and score display, and target movement system capable of 360-degree rotation.<\/p>\n\n\n\n<h2>Implementation<\/h2>\n\n\n\n<p>Our final implementation consisted of the hit registration system, the rotating movement system, and the control and scoring system. The hit registration system was designed based on a limit switch and hinge combo. This system proved difficult to implement because the original hinges we used had very loose tolerances which introduced more errors and made hit registration inconsistent. The newer metal hinges we purchased had much tighter tolerances and produced much better results.&nbsp;<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-1024x576.jpg\" alt=\"\" class=\"wp-image-5152\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211512558-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Hit recognition system<\/figcaption><\/figure>\n\n\n\n<p>The rotational motion system produced the most interesting challenge as we wanted to produce a system with full 360-degree rotation and electronic components on both the rotating piece and the box. We were able to solve this issue using a slip ring which allowed us to connect our rotating switches to our fixed microcontroller. This slip ring needed to be at the axis of rotation which presented an issue as this would take the place of any axle-based system we might have otherwise used. Garth\u2019s open hub design helped us solve this problem, by allowing us to create a rotational movement system with an open center, allowing us to pass wires through the center.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-1024x576.jpg\" alt=\"\" data-id=\"5153\" data-full-url=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-scaled.jpg\" data-link=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?attachment_id=5153\" class=\"wp-image-5153\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211352094-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-1024x576.jpg\" alt=\"\" data-id=\"5154\" data-full-url=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-scaled.jpg\" data-link=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?attachment_id=5154\" class=\"wp-image-5154\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211530878-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>We controlled the motion system by tuning the speed of the motor to suit the state of the game. In demo mode, the motor will follow a simple sinusoidal wave. During play, the motor\u2019s speed is the sum of two sinusoidal waves of differing periods creating a randomized effect. After a hit, the motor will operate with a higher speed floor, and a shorter sinusoidal period to create the illusion that the monster is recoiling from the hit.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-1024x576.jpg\" alt=\"\" data-id=\"5156\" data-full-url=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-scaled.jpg\" data-link=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?attachment_id=5156\" class=\"wp-image-5156\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211400646-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-1024x576.jpg\" alt=\"\" data-id=\"5155\" data-full-url=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-scaled.jpg\" data-link=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?attachment_id=5155\" class=\"wp-image-5155\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/PXL_20211123_211408039-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>The electronics system also included the scoring system. The scoring system increments the score based on how long the switches on the eye have been pressed. This score is then displayed on the LCD display. The system also supports multiple games as the player can end the game by pressing the \u201cStart\/Stop\u201d button to enter demo mode, and then pressing the \u201cStart\/Stop\u201d button again to enter play mode once again. This action will set the score to zero.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"960\" height=\"720\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/Electronic-Schematic.jpg\" alt=\"\" class=\"wp-image-5159\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/Electronic-Schematic.jpg 960w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/Electronic-Schematic-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/Electronic-Schematic-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/12\/Electronic-Schematic-508x381.jpg 508w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<h2>Outcomes<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"955\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render-1024x955.jpg\" alt=\"\" class=\"wp-image-5157\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render-1024x955.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render-300x280.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render-768x716.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render-973x907.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render-508x474.jpg 508w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/render.jpg 1328w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Our main successes were the use of the slip ring, switch mounting, and the long-running nature of our project. The early incorporation of the slip ring in our design allowed us to manage our wiring in one place and, most importantly, gave us full rotation on a single axis. The switch mounting also introduced another degree of freedom by allowing us to fine-tune the hit recognition system. The mounting was critical in determining which position would offer the most consistent actuation. Another important success was the persistence of our project. The centralized design and mounting ensured the rotating mechanism was able to keep moving for relatively long periods of time. <\/p>\n\n\n\n<p>Unexpected successes arose when new players interacted with our project.  Many of our users were captivated by both the crazy visuals and bizarre mechanical behavior of our machine. Their experience was enhanced through the self-imposed difficulty of our game as well as the feedback from scoring. Over time, users developed their own game modes, one of which was a co-op mode of sorts that involved various users dropping marbles. <\/p>\n\n\n\n<h2>Future Work<\/h2>\n\n\n\n<ul><li>Smoother and more accessible return system (possibel skeeball implementation)<\/li><li>Sound from speakers with sound effects for hits and music<\/li><li>More game modes<\/li><\/ul>\n\n\n\n<h2>Contributions<\/h2>\n\n\n\n<p><strong>Jason Perez<\/strong> &#8211; Helped come up with ideas during brainstorming, introduced hinges as a component to the target system, developed central rotator piece through CAD, developed switch mounting through CAD, programmed initial code for testing switches-motor-LCD, graphic design\/theme of the project<\/p>\n\n\n\n<p><strong>Michael Nguyen<\/strong> &#8211; created Box Full Assembly CAD model, converted code to polling states to allow for simulated multitasking, motion profiled rotator for demo, play, and freakout states, designed gearbox and debugged LCD display.<\/p>\n\n\n\n<h2>Media<\/h2>\n\n\n\n<p>Video<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"eyeDrop Attack!\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/F6ntTzDz3_o?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Gallery<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"683\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-1024x683.jpg\" alt=\"\" data-id=\"5149\" class=\"wp-image-5149\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-1024x683.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-300x200.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-768x512.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-1536x1024.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-973x649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion-508x339.jpg 508w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_in_motion.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-1024x576.jpg\" alt=\"\" data-id=\"5150\" data-link=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?attachment_id=5150\" class=\"wp-image-5150\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/closeup_still-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-1024x576.jpg\" alt=\"\" data-id=\"5151\" data-full-url=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-scaled.jpg\" data-link=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/?attachment_id=5151\" class=\"wp-image-5151\" srcset=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-1024x576.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-300x169.jpg 300w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-768x432.jpg 768w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-1536x864.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-2048x1152.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-973x547.jpg 973w, https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/rotator_view_still-508x286.jpg 508w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h2>Citations<\/h2>\n\n\n\n<p>Motor Sample Code: <\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/text\/code\/pico-motor.html#id7\" target=\"_blank\">https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/text\/code\/pico-motor.html#id7<\/a><\/p>\n\n\n\n<p>Hub:<\/p>\n\n\n\n<p><a href=\"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/text\/mechanism\/open-hub.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/text\/mechanism\/open-hub.html<\/a><\/p>\n\n\n\n<h2>Code + CAD<\/h2>\n\n\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# dual_spin.py\n#\n# Raspberry Pi Pico - DC motor motion demo\n#\n# Demonstrates operating two DC motors driven by a DRV8833.\n#\n# This assumes a Pololu DRV8833 dual motor driver has been wired up to the Pico as follows:\n#   Pico pin 24, GPIO18   -&amp;gt; AIN1\n#   Pico pin 25, GPIO19   -&amp;gt; AIN2\n#   Pico pin 26, GPIO20   -&amp;gt; BIN2\n#   Pico pin 27, GPIO21   -&amp;gt; BIN1\n#   any Pico GND          -&amp;gt; GND\n\n# DRV8833 carrier board: https:\/\/www.pololu.com\/product\/2130\n\n################################################################\n# CircuitPython module documentation:\n# time    https:\/\/circuitpython.readthedocs.io\/en\/latest\/shared-bindings\/time\/index.html\n# math    https:\/\/circuitpython.readthedocs.io\/en\/latest\/shared-bindings\/math\/index.html\n# board   https:\/\/circuitpython.readthedocs.io\/en\/latest\/shared-bindings\/board\/index.html\n# pwmio   https:\/\/circuitpython.readthedocs.io\/en\/latest\/shared-bindings\/pwmio\/index.html\n\n################################################################################\n# print a banner as reminder of what code is loaded\nprint(&quot;Starting dual_spin script.&quot;)\n\n# load standard Python modules\nimport math, time\n\n# load the CircuitPython hardware definition module for pin definitions\nimport board\n\n# load the CircuitPython pulse-width-modulation module for driving hardware\nimport pwmio\n\nimport busio\n\nimport adafruit_ht16k33.segments\n\nfrom digitalio import DigitalInOut, Direction, Pull\n\n#--------------------------------------------------------------------------------\n# Class to represent a single dual H-bridge driver.\n\nclass DRV8833():\n    def __init__(self, AIN1=board.GP18, AIN2=board.GP19, BIN2=board.GP20, BIN1=board.GP21, pwm_rate=20000):\n        # Create a pair of PWMOut objects for each motor channel.\n        self.ain1 = pwmio.PWMOut(AIN1, duty_cycle=0, frequency=pwm_rate)\n        self.ain2 = pwmio.PWMOut(AIN2, duty_cycle=0, frequency=pwm_rate)\n\n        self.bin1 = pwmio.PWMOut(BIN1, duty_cycle=0, frequency=pwm_rate)\n        self.bin2 = pwmio.PWMOut(BIN2, duty_cycle=0, frequency=pwm_rate)\n\n    def write(self, channel, rate):\n        &quot;&quot;&quot;Set the speed and direction on a single motor channel.\n\n        :param channel:  0 for motor A, 1 for motor B\n        :param rate: modulation value between -1.0 and 1.0, full reverse to full forward.&quot;&quot;&quot;\n\n        # convert the rate into a 16-bit fixed point integer\n        pwm = min(max(int(2**16 * abs(rate)), 0), 65535)\n\n        if channel == 0:\n            if rate &lt; 0:\n                self.ain1.duty_cycle = pwm\n                self.ain2.duty_cycle = 0\n            else:\n                self.ain1.duty_cycle = 0\n                self.ain2.duty_cycle = pwm\n        else:\n            if rate &lt; 0:\n                self.bin1.duty_cycle = pwm\n                self.bin2.duty_cycle = 0\n            else:\n                self.bin1.duty_cycle = 0\n                self.bin2.duty_cycle = pwm\n\n\n#--------------------------------------------------------------------------------\n# Create an object to represent a dual motor driver.\nprint(&quot;Creating driver object.&quot;)\ndriver = DRV8833()\nspeed = 0.65\n\n#LED\nled = DigitalInOut(board.LED)\nled.direction = Direction.OUTPUT\nled.value = True\n\n#7 Segment Display\ni2c = busio.I2C(scl=board.GP5, sda=board.GP4)\ndisplay = adafruit_ht16k33.segments.Seg7x4(i2c)\n\n#Switches\n\nswitchStart = DigitalInOut(board.GP9)\nswitchStart.pull = Pull.DOWN\nswitchStart.direction = Direction.OUTPUT\nwasPressed = False\n\nswitch0 = DigitalInOut(board.GP10)\nswitch0.pull = Pull.DOWN\nswitch0.direction = Direction.OUTPUT\n\nswitch1 = DigitalInOut(board.GP11)\nswitch1.pull = Pull.DOWN\nswitch1.direction = Direction.OUTPUT\n\nswitch2 = DigitalInOut(board.GP12)\nswitch2.pull = Pull.DOWN\nswitch2.direction = Direction.OUTPUT\n\nswitch3 = DigitalInOut(board.GP13)\nswitch3.pull = Pull.DOWN\nswitch3.direction = Direction.OUTPUT\n\nswitch4 = DigitalInOut(board.GP14)\nswitch4.pull = Pull.DOWN\nswitch4.direction = Direction.OUTPUT\n\nswitch5 = DigitalInOut(board.GP15)\nswitch5.pull = Pull.DOWN\nswitch5.direction = Direction.OUTPUT\n\n#States?\ndemoMode = True\n\n#--------------------------------------------------------------------------------\n# Begin the main processing loop.  This is structured as a looping script, since\n# each movement primitive 'blocks', i.e. doesn't return until the action is\n# finished.\n\nclass Game:\n    def __init__(self):\n        self.score = 0\n        self.scoreScale = 5\n        self.motorTime = 0.01\n        self.nextMotorTime = 0.01\n        self.demoMode = True\n        self.wasReleased = True\n        self.startTime = time.time()\n\n        self.hurtTime = 0\n\n    def getSpeed(self,scale):\n        currTime = time.time() - self.startTime\n        speed = math.sin(currTime\/scale)\n        return min(max(abs(speed), 0.6), 0.8) * (speed \/ (abs(speed) + 0.001))\n\n    def pollMainSwitches(self):\n        if not self.demoMode:\n            if switch0.value or switch1.value or switch2.value or switch3.value or switch4.value or switch5.value:\n                self.score += self.scoreScale\n                self.hurtTime = time.time() + 1\n\n    def pollMotors(self):\n        currTime = time.time()\n        if (currTime &amp;gt;= self.nextMotorTime):\n            self.nextMotorTime = currTime + self.motorTime\n            if (self.demoMode):\n                speed = self.getSpeed(2)\n                driver.write(1, speed)\n            elif (currTime &lt;= self.hurtTime):\n                speed = 4 * self.getSpeed(0.001)\n                driver.write(1, speed)\n            else:\n                speed = self.getSpeed(2)\n                driver.write(1, speed)\n\n    def pollStart(self):\n        if not switchStart.value:\n            self.wasReleased = True\n        if self.wasReleased and switchStart.value:\n            self.demoMode = not self.demoMode\n            led.value = False\n            self.wasReleased = False\n\n    def pollDisplay(self):\n        if self.demoMode:\n            #Press\n            display.set_digit_raw(0, 0b01110011) #P\n            display.set_digit_raw(1, 0b01010000) #r\n            display[2] = &quot;e&quot;\n            display[3] = &quot;5&quot;\n            display.scroll(1)\n            display[3] = &quot;5&quot;\n            display.show()\n            display.scroll(1)\n            display[3] = &quot; &quot;\n            display.show()\n            display.scroll(1)\n            display.set_digit_raw(3, 0b01111000) #t\n            display.show()\n            display.scroll(1)\n            display.set_digit_raw(3, 0b01011100) #o\n            display.show()\n            display.scroll(1)\n            display[3] = &quot; &quot;\n            display.show()\n            display.scroll(1)\n            display[3] = &quot;5&quot;\n            display.show()\n            display.scroll(1)\n            display.set_digit_raw(1, 0b01111000)\n            display.show()\n            display.scroll(1)\n            display[3] = &quot;a&quot;\n            display.show()\n            display.scroll(1)\n            display.set_digit_raw(3, 0b01010000)\n            display.show()\n            display.scroll(1)\n            display.set_digit_raw(1, 0b01111000)\n            display.show()\n            display.scroll(1)\n            display[3] = &quot; &quot;\n            \n            \n            #Start\n            #display[0] = &quot;5&quot;\n            #display.set_digit_raw(1, 0b01111000)\n            #display[2] = &quot;A&quot;\n            #display.set_digit_raw(3, 0b01010000)\n            #display.set_digit_raw(1, 0b01111000)\n        else:\n            display.print(&quot;%04d&quot; % self.score)\n\n\n\n\n\nprint(&quot;Starting main script.&quot;)\nscale = 2.0\nstartTime = time.time()\ngame = Game();\n\nwhile True:\n    currTime = time.time() - startTime\n\n    led.value = game.demoMode\n    game.pollMotors()\n    game.pollDisplay()\n    game.pollMainSwitches()\n    game.pollStart();\n<\/pre>\n\n\n<p>CAD Files:<\/p>\n\n\n\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1EFqiocY5mWaKRPtHlE2MzSBPyFFcaLiz\/view?usp=sharing\">https:\/\/drive.google.com\/file\/d\/1EFqiocY5mWaKRPtHlE2MzSBPyFFcaLiz\/view?usp=sharing<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Team: Micheal Nguyen and Jason Perez Abstract Our goal was to create an interactive game where a user could use marble projectiles to shoot at targets and score&#8230;<\/p>\n","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/5148"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/comments?post=5148"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/5148\/revisions"}],"predecessor-version":[{"id":5167,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/5148\/revisions\/5167"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/media?parent=5148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/categories?post=5148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2021\/work\/wp-json\/wp\/v2\/tags?post=5148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}