Projects update: add Obsolete flag
[beagleboard.org.git] / db / 2814.xml
blob42d51f034a49197391ffc6663219f36153151c42
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <?xml-stylesheet type="text/xsl" href="helma.xsl"?>
3 <xmlroot xmlns:hop="http://www.helma.org/docs/guide/features/database">
4   <hopobject id="2814" name="2AxisThumbJoystick" prototype="Page" created="1372444995090" lastModified="1387488787005">
5   <hop:parent idref="2471" prototyperef="Page"/>
6     <is_xhtml type="boolean">true</is_xhtml>
7     <http_remotehost>192.91.75.30</http_remotehost>
8     <http_language>en-US,en;q=0.8,fr;q=0.6</http_language>
9     <uri>2AxisThumbJoystick</uri>
10     <http_browser>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36</http_browser>
11     <time type="date">19.12.2013 15:33:07 CST</time>
12     <hopsession>192.91.75.1qb2qdg7e5z6r</hopsession>
13     <body>&lt;script src=&quot;/static/bonescript-demo.js&quot;&gt;&lt;/script&gt;\r
14 &lt;div id=&apos;side-menu&apos; class=&quot;t3_sidebar&quot;&gt;\r
15     &lt;ul class=&quot;left-menu&quot;&gt;&lt;strong&gt;Navigation&lt;/strong&gt;\r
16         &lt;li&gt;&lt;a href=&quot;/static/side-menu.html&quot;&gt;Menu contents&lt;/a&gt;&lt;/li&gt;\r
17     &lt;/ul&gt;\r
18 &lt;/div&gt;\r
19 &lt;div class=&quot;t3_content_1&quot;&gt;&lt;div id=&apos;connect-status&apos;&gt;&lt;/div&gt;&lt;div id=&quot;content_child&quot;&gt;\r
20 &lt;h1&gt;Demo: Adafruit 2-Axis Thumb Joystick&lt;/h1&gt;\r
21 &lt;p&gt; The &lt;a href=&quot;http://www.adafruit.com/products/512&quot; class=&quot;external&quot;&gt;Analog\r
22 2-axis Thumb Joystick&lt;/a&gt; allows you to easily mount a PSP/Xbox-like thumb\r
23 joystick to your project. Using analog pins, the BeagleBone will read and determine\r
24 both the X and Y axis. The\r
25 joystick also includes an extra digital input that will let you read the switch. \r
26 &lt;/p&gt;\r
28 &lt;i&gt;The console will output both the x-axis and y-axis with readings from 0-100, with (50,50) being the center location.&lt;/i&gt;\r
29 &lt;br&gt;\r
31 &lt;h2&gt;Example\r
32  &lt;button class=&quot;dynlink&quot; onclick=&quot;demoRun(&apos;code&apos;)&quot;&gt;run&lt;/button&gt;\r
33  &lt;button class=&quot;dynlink&quot; onclick=&quot;demoRestore(&apos;code&apos;)&quot;&gt;restore&lt;/button&gt;\r
34 &lt;/h2&gt;\r
35 &lt;pre id=&quot;code&quot; class=&quot;use-editor&quot; style=&quot;height:230px;&quot;&gt;\r
36 var b = require(&apos;bonescript&apos;);\r
37 var pos = {};\r
39 b.analogRead(&apos;P9_36&apos;, onX);\r
41 function onX(x) {\r
42     pos.x = parseFloat(x.value * 100).toFixed(2);\r
43     b.analogRead(&apos;P9_38&apos;, onY);\r
44 }\r
46 function onY(x) {\r
47     pos.y = parseFloat(x.value * 100).toFixed(2);\r
48         console.log(JSON.stringify(pos));\r
49 }\r
50 &lt;/pre&gt;\r
51 &lt;div readonly id=&apos;console-output&apos; style=&quot;height:100px;&quot;&gt;&lt;/div&gt;\r
52 &lt;br&gt;&lt;/br&gt;\r
53 &lt;img align=&quot;right&quot; width=&quot;70%&quot; src=&quot;http://beagleboard.org/static/uploads/Joystick1.PNG&quot;/&gt;\r
54 &lt;br&gt;&lt;/br&gt;\r
55 &lt;h2&gt;Build and execute instructions&lt;/h2&gt;\r
56 &lt;ul&gt;\r
57  &lt;li&gt;Connect the &quot;VCC&quot; pin from the joystick to P9_32 of the BeagleBone.&lt;/li&gt;\r
58  &lt;li&gt;Connect the &quot;VER&quot; pin from the joystick to P9_38 of the BeagleBone.&lt;/li&gt;\r
59  &lt;li&gt;Connect the &quot;HOR&quot; pin from the joystick to P9_36 of the BeagleBone.&lt;/li&gt;\r
60  &lt;li&gt;Connect the &quot;SEL&quot; pin from the joystick to P9_42 of the BeagleBone.&lt;/li&gt;\r
61  &lt;li&gt;Connect the &quot;GND&quot; pin from the joystick to P9_34 of the BeagleBone.&lt;/li&gt;\r
62  &lt;li&gt;Click &quot;Run&quot; on the code and it will output both the x and y axis, with 50,50 being the center.&lt;/li&gt;\r
63 &lt;/ul&gt;\r
65 &lt;h2&gt;See also&lt;/h2&gt;\r
66 &lt;h3&gt;Related functions&lt;/h3&gt;\r
67 &lt;ul&gt;\r
68  &lt;li&gt;&lt;a href=&quot;/Support/BoneScript/#require&quot;&gt;require&lt;/a&gt;&lt;/li&gt;\r
69  &lt;li&gt;&lt;a href=&quot;/Support/BoneScript/analogRead/&quot;&gt;analogRead&lt;/a&gt;&lt;/li&gt;\r
70 &lt;/ul&gt;\r
72 &lt;h3&gt;Where to buy&lt;/h3&gt;\r
73 &lt;ul&gt;\r
74 &lt;li&gt; &lt;a href=&quot;http://elinux.org/CircuitCo:BeagleBone_Breadboard#Distributors&quot;&gt;BreadBoard&lt;/a&gt;&lt;/li&gt;\r
75  &lt;li&gt;&lt;a href=&quot;http://www.adafruit.com/products/512&quot;&gt;Joystick&lt;/a&gt;&lt;/li&gt;\r
76  &lt;li&gt;&lt;a href=&quot;https://www.sparkfun.com/products/11026&quot;&gt;Jumper wires&lt;/a&gt;&lt;/li&gt;\r
77 &lt;/ul&gt;\r
79 &lt;h2&gt;See it in action&lt;/h2&gt;\r
80 &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/tB3hM5whNN8&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;</body>
81     <pseudoparent idref="2471" prototyperef="Page"/>
82     <http_referer>http://beagleboard.org/support/BoneScript/2AxisThumbJoystick/edit</http_referer>
83     <http_host>beagleboard.org</http_host>
84     <user>jessica.lynne.callaway@gmail.com</user>
85     <lang>en-us</lang>
86   </hopobject>
87 </xmlroot>