Compare commits

..

1 Commits

Author SHA1 Message Date
5shekel
752cbd3374 removed new work 2016-04-12 11:29:20 +02:00
6 changed files with 62 additions and 3578 deletions

View File

@ -4,11 +4,3 @@ based on 2 wiper motors, NRF24 and a VNH2SP30 motor driver based arduino shield
![](https://i.imgur.com/jb0e2Xa.png) ![](https://i.imgur.com/jb0e2Xa.png)
![](https://i.imgur.com/SxAtMcw.png) ![](https://i.imgur.com/SxAtMcw.png)
![](https://i.imgur.com/LzyucU1.png) ![](https://i.imgur.com/LzyucU1.png)
##relay guides
http://www.learningaboutelectronics.com/Articles/DPDT-relay-wiring-diagram
http://www.me.umn.edu/courses/me2011/arduino/technotes/dcmotors/bidirectional/bidirMotor.html
![](http://i.imgur.com/Yjcg2WQ.jpg)
[relay DPDT online simulation](http://lushprojects.com/circuitjs/circuitjs.html?cct=$+1+0.000005+10.200277308269968+50+5+50%0A178+256+208+400+208+0+2+0.2+0.2585230348539524+0.05+1000000+0.02+20%0A172+224+208+160+208+0+6+12+12+0+0+0.5+Coil+Voltage%0Ag+256+320+256+352+0%0A181+544+160+592+160+0+300.0680411695022+100+120+0.4+0.4%0A181+544+224+592+224+0+300.0064191237612+100+120+0.4+0.4%0Aw+544+160+544+224+0%0Ad+592+160+640+160+1+0.805904783%0Ad+640+224+592+224+1+0.805904783%0Aw+640+160+640+224+0%0Aw+400+144+432+144+0%0Aw+432+144+432+224+0%0Aw+432+224+400+224+0%0Aw+400+176+400+192+0%0Aw+256+240+224+240+0%0Aw+256+208+224+208+0%0Aw+400+176+512+176+0%0Aw+512+224+432+224+0%0Aw+512+160+544+160+0%0Aw+512+224+512+256+0%0Aw+512+256+640+256+0%0Aw+640+224+640+256+0%0Ax+551+245+627+248+0+18+DC+motor%0Aw+512+160+512+176+0%0At+224+304+256+304+0+1+-6.114769651509018+0.7147696515114635+100%0Aw+256+256+256+288+0%0Aw+224+240+224+208+0%0AR+64+304+16+304+0+0+40+3.3+0+0+0.5%0Ar+176+304+208+304+0+1000%0Af+176+112+224+112+0+1.5%0Ag+224+128+224+160+0%0Ar+176+112+144+112+0+1000%0As+64+112+144+112+0+1+false%0Aw+224+96+224+64+0%0Aw+256+96+256+160+0%0Aw+64+304+64+112+0%0As+64+304+144+304+0+0+false%0Aw+176+304+144+304+0%0Aw+224+304+208+304+0%0Ax+53+85+187+88+0+24+on/off+(pwm)%0Ax+60+333+151+336+0+24+direction%0Aw+224+64+256+64+0%0Aw+256+64+256+96+0%0Ad+256+160+256+208+1+0.805904783%0A)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,48 +0,0 @@
$ 1 0.000005 10.200277308269968 50 5 50
178 528 224 672 224 0 2 0.2 0.25852303485395484 0.05 1000000 0.02 20
172 496 256 432 256 0 6 12 12 0 0 0.5 Coil Voltage
g 528 336 528 368 0
181 816 176 864 176 0 317.2594044951429 100 120 0.4 0.4
181 816 240 864 240 0 300.0000000023203 100 120 0.4 0.4
w 816 176 816 240 0
d 864 176 912 176 1 0.805904783
d 912 240 864 240 1 0.805904783
w 912 176 912 240 0
w 672 160 704 160 0
w 704 160 704 240 0
w 704 240 672 240 0
w 672 192 672 208 0
w 528 256 496 256 0
w 672 192 784 192 0
w 784 240 704 240 0
w 784 176 816 176 0
w 784 240 784 272 0
w 784 272 912 272 0
w 912 240 912 272 0
x 823 261 899 264 0 18 DC motor
w 784 176 784 192 0
t 496 320 528 320 0 1 -6.114769651175784 0.7147696515114638 100
w 528 272 528 304 0
R 256 320 208 320 0 0 40 3.3 0 0 0.5
r 448 320 480 320 0 1000
g 528 224 448 224 0
r 432 96 400 96 0 1000
s 288 96 400 96 0 1 false
w 256 320 256 128 0
s 336 320 416 320 0 0 false
w 448 320 416 320 0
w 496 320 480 320 0
x 274 122 408 125 0 24 on/off (pwm)
x 332 349 423 352 0 24 direction
w 528 144 528 176 0
178 464 32 608 32 0 1 0.2 5.09996698205839e-12 0.05 1000000 0.02 20
t 432 96 464 96 0 1 -11.901460454706257 0.09853954519174238 100
g 464 112 464 144 0
w 256 320 336 320 0
w 256 128 256 96 0
w 256 96 288 96 0
172 464 64 400 64 0 6 12 12 0 0 0.5 Coil Voltage
w 608 48 608 112 0
w 608 112 528 112 0
w 528 112 528 144 0
172 464 32 400 32 0 6 12 12 0 0 0.5 Coil Voltage

View File

@ -1,597 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="7.2.0">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
<setting verticaltext="up"/>
</settings>
<grid distance="50" unitdist="mil" unit="mil" style="lines" multiple="1" display="no" altdistance="25" altunitdist="mil" altunit="mil"/>
<layers>
<layer number="1" name="Top" color="4" fill="1" visible="yes" active="yes"/>
<layer number="2" name="Route2" color="1" fill="3" visible="no" active="no"/>
<layer number="3" name="Route3" color="4" fill="3" visible="no" active="no"/>
<layer number="4" name="Route4" color="1" fill="4" visible="no" active="no"/>
<layer number="5" name="Route5" color="4" fill="4" visible="no" active="no"/>
<layer number="6" name="Route6" color="1" fill="8" visible="no" active="no"/>
<layer number="7" name="Route7" color="4" fill="8" visible="no" active="no"/>
<layer number="8" name="Route8" color="1" fill="2" visible="no" active="no"/>
<layer number="9" name="Route9" color="4" fill="2" visible="no" active="no"/>
<layer number="10" name="Route10" color="1" fill="7" visible="no" active="no"/>
<layer number="11" name="Route11" color="4" fill="7" visible="no" active="no"/>
<layer number="12" name="Route12" color="1" fill="5" visible="no" active="no"/>
<layer number="13" name="Route13" color="4" fill="5" visible="no" active="no"/>
<layer number="14" name="Route14" color="1" fill="6" visible="no" active="no"/>
<layer number="15" name="Route15" color="4" fill="6" visible="no" active="no"/>
<layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/>
<layer number="17" name="Pads" color="2" fill="1" visible="yes" active="yes"/>
<layer number="18" name="Vias" color="2" fill="1" visible="yes" active="yes"/>
<layer number="19" name="Unrouted" color="6" fill="1" visible="yes" active="yes"/>
<layer number="20" name="Dimension" color="15" fill="1" visible="yes" active="yes"/>
<layer number="21" name="tPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="22" name="bPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="23" name="tOrigins" color="15" fill="1" visible="yes" active="yes"/>
<layer number="24" name="bOrigins" color="15" fill="1" visible="yes" active="yes"/>
<layer number="25" name="tNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="26" name="bNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="27" name="tValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="28" name="bValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="29" name="tStop" color="7" fill="3" visible="no" active="yes"/>
<layer number="30" name="bStop" color="7" fill="6" visible="no" active="yes"/>
<layer number="31" name="tCream" color="7" fill="4" visible="no" active="yes"/>
<layer number="32" name="bCream" color="7" fill="5" visible="no" active="yes"/>
<layer number="33" name="tFinish" color="6" fill="3" visible="no" active="yes"/>
<layer number="34" name="bFinish" color="6" fill="6" visible="no" active="yes"/>
<layer number="35" name="tGlue" color="7" fill="4" visible="no" active="yes"/>
<layer number="36" name="bGlue" color="7" fill="5" visible="no" active="yes"/>
<layer number="37" name="tTest" color="7" fill="1" visible="no" active="yes"/>
<layer number="38" name="bTest" color="7" fill="1" visible="no" active="yes"/>
<layer number="39" name="tKeepout" color="4" fill="11" visible="yes" active="yes"/>
<layer number="40" name="bKeepout" color="1" fill="11" visible="yes" active="yes"/>
<layer number="41" name="tRestrict" color="4" fill="10" visible="yes" active="yes"/>
<layer number="42" name="bRestrict" color="1" fill="10" visible="yes" active="yes"/>
<layer number="43" name="vRestrict" color="2" fill="10" visible="yes" active="yes"/>
<layer number="44" name="Drills" color="7" fill="1" visible="no" active="yes"/>
<layer number="45" name="Holes" color="7" fill="1" visible="no" active="yes"/>
<layer number="46" name="Milling" color="3" fill="1" visible="no" active="yes"/>
<layer number="47" name="Measures" color="7" fill="1" visible="no" active="yes"/>
<layer number="48" name="Document" color="7" fill="1" visible="yes" active="yes"/>
<layer number="49" name="Reference" color="7" fill="1" visible="yes" active="yes"/>
<layer number="50" name="dxf" color="7" fill="1" visible="no" active="no"/>
<layer number="51" name="tDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="52" name="bDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="53" name="tGND_GNDA" color="7" fill="1" visible="no" active="no"/>
<layer number="54" name="bGND_GNDA" color="7" fill="1" visible="no" active="no"/>
<layer number="56" name="wert" color="7" fill="1" visible="no" active="no"/>
<layer number="57" name="tCAD" color="7" fill="1" visible="no" active="no"/>
<layer number="90" name="Modules" color="5" fill="1" visible="no" active="no"/>
<layer number="91" name="Nets" color="2" fill="1" visible="no" active="no"/>
<layer number="92" name="Busses" color="1" fill="1" visible="no" active="no"/>
<layer number="93" name="Pins" color="2" fill="1" visible="no" active="no"/>
<layer number="94" name="Symbols" color="4" fill="1" visible="no" active="no"/>
<layer number="95" name="Names" color="7" fill="1" visible="no" active="no"/>
<layer number="96" name="Values" color="7" fill="1" visible="no" active="no"/>
<layer number="97" name="Info" color="7" fill="1" visible="no" active="no"/>
<layer number="98" name="Guide" color="6" fill="1" visible="no" active="no"/>
<layer number="99" name="SpiceOrder" color="7" fill="1" visible="no" active="no"/>
<layer number="100" name="Muster" color="7" fill="1" visible="yes" active="yes"/>
<layer number="101" name="Patch_Top" color="7" fill="1" visible="yes" active="yes"/>
<layer number="102" name="Vscore" color="7" fill="1" visible="yes" active="yes"/>
<layer number="103" name="ATT_MISO" color="7" fill="1" visible="yes" active="yes"/>
<layer number="104" name="Name" color="7" fill="1" visible="yes" active="yes"/>
<layer number="105" name="Beschreib" color="7" fill="1" visible="yes" active="yes"/>
<layer number="106" name="BGA-Top" color="7" fill="1" visible="yes" active="yes"/>
<layer number="107" name="BD-Top" color="7" fill="1" visible="yes" active="yes"/>
<layer number="108" name="centerline" color="7" fill="1" visible="yes" active="yes"/>
<layer number="109" name="fp9" color="7" fill="1" visible="no" active="yes"/>
<layer number="110" name="fp0" color="7" fill="1" visible="no" active="yes"/>
<layer number="111" name="LPC17xx" color="7" fill="1" visible="no" active="yes"/>
<layer number="112" name="tSilk" color="7" fill="1" visible="no" active="yes"/>
<layer number="113" name="ReferenceLS" color="7" fill="1" visible="no" active="no"/>
<layer number="116" name="Patch_BOT" color="7" fill="1" visible="yes" active="yes"/>
<layer number="118" name="Rect_Pads" color="7" fill="1" visible="no" active="no"/>
<layer number="121" name="_tsilk" color="7" fill="1" visible="yes" active="yes"/>
<layer number="122" name="_bsilk" color="7" fill="1" visible="yes" active="yes"/>
<layer number="123" name="tTestmark" color="7" fill="1" visible="no" active="yes"/>
<layer number="124" name="bTestmark" color="7" fill="1" visible="no" active="yes"/>
<layer number="125" name="_tNames" color="7" fill="1" visible="no" active="yes"/>
<layer number="126" name="_bNames" color="7" fill="1" visible="no" active="yes"/>
<layer number="127" name="_tValues" color="7" fill="1" visible="no" active="yes"/>
<layer number="128" name="_bValues" color="7" fill="1" visible="no" active="yes"/>
<layer number="131" name="prix" color="7" fill="1" visible="yes" active="yes"/>
<layer number="132" name="test" color="7" fill="1" visible="yes" active="yes"/>
<layer number="144" name="Drill_legend" color="7" fill="1" visible="no" active="yes"/>
<layer number="150" name="Notes" color="7" fill="1" visible="no" active="yes"/>
<layer number="151" name="HeatSink" color="7" fill="1" visible="yes" active="yes"/>
<layer number="152" name="_bDocu" color="7" fill="1" visible="no" active="yes"/>
<layer number="153" name="FabDoc1" color="6" fill="1" visible="no" active="no"/>
<layer number="154" name="FabDoc2" color="2" fill="1" visible="no" active="no"/>
<layer number="155" name="FabDoc3" color="7" fill="15" visible="no" active="no"/>
<layer number="199" name="Contour" color="7" fill="1" visible="no" active="yes"/>
<layer number="200" name="200bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="201" name="201bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="202" name="202bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="203" name="203bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="204" name="204bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="205" name="205bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="206" name="206bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="207" name="207bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="208" name="208bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="209" name="209bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="210" name="210bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="211" name="211bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="212" name="212bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="213" name="213bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="214" name="214bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="215" name="215bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="216" name="216bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="217" name="217bmp" color="18" fill="1" visible="no" active="no"/>
<layer number="218" name="218bmp" color="19" fill="1" visible="no" active="no"/>
<layer number="219" name="219bmp" color="20" fill="1" visible="no" active="no"/>
<layer number="220" name="220bmp" color="21" fill="1" visible="no" active="no"/>
<layer number="221" name="221bmp" color="22" fill="1" visible="no" active="no"/>
<layer number="222" name="222bmp" color="23" fill="1" visible="no" active="no"/>
<layer number="223" name="223bmp" color="24" fill="1" visible="no" active="no"/>
<layer number="224" name="224bmp" color="25" fill="1" visible="no" active="no"/>
<layer number="231" name="Eagle3D_PG1" color="7" fill="1" visible="no" active="no"/>
<layer number="232" name="Eagle3D_PG2" color="7" fill="1" visible="no" active="no"/>
<layer number="233" name="Eagle3D_PG3" color="7" fill="1" visible="no" active="no"/>
<layer number="248" name="Housing" color="7" fill="1" visible="no" active="yes"/>
<layer number="249" name="Edge" color="7" fill="1" visible="no" active="yes"/>
<layer number="250" name="Descript" color="7" fill="1" visible="yes" active="yes"/>
<layer number="251" name="SMDround" color="7" fill="1" visible="yes" active="yes"/>
<layer number="254" name="cooling" color="7" fill="1" visible="yes" active="yes"/>
</layers>
<board>
<plain>
<wire x1="0" y1="0" x2="81.26" y2="0" width="0" layer="20"/>
<wire x1="81.26" y1="0" x2="81.26" y2="28.88" width="0" layer="20"/>
<wire x1="81.26" y1="28.88" x2="0" y2="28.88" width="0" layer="20"/>
<wire x1="0" y1="28.88" x2="0" y2="0" width="0" layer="20"/>
<text x="7.62" y="21.59" size="1.778" layer="21">+12V</text>
<text x="7.62" y="17.78" size="1.778" layer="21">GND</text>
</plain>
<libraries>
<library name="relay">
<description>&lt;b&gt;Relays&lt;/b&gt;&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;Eichhoff
&lt;li&gt;Finder
&lt;li&gt;Fujitsu
&lt;li&gt;HAMLIN
&lt;li&gt;OMRON
&lt;li&gt;Matsushita
&lt;li&gt;NAiS
&lt;li&gt;Siemens
&lt;li&gt;Schrack
&lt;/ul&gt;
&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>
<packages>
<package name="F4052">
<description>&lt;b&gt;RELAY&lt;/b&gt;&lt;p&gt;
2 x switch, Finder</description>
<wire x1="22.9616" y1="-6.2992" x2="22.9616" y2="6.1976" width="0.1524" layer="21"/>
<wire x1="22.9616" y1="6.1976" x2="-6.2992" y2="6.1976" width="0.1524" layer="21"/>
<wire x1="-6.2992" y1="6.1976" x2="-6.2992" y2="-6.2992" width="0.1524" layer="21"/>
<wire x1="-6.2992" y1="-6.2992" x2="22.9616" y2="-6.2992" width="0.1524" layer="21"/>
<wire x1="-3.81" y1="2.0574" x2="-3.81" y2="1.1938" width="0.1524" layer="21"/>
<wire x1="-1.8034" y1="1.1938" x2="-1.8034" y2="-1.3208" width="0.254" layer="21"/>
<wire x1="-5.8166" y1="-1.3208" x2="-5.8166" y2="1.1938" width="0.254" layer="21"/>
<wire x1="-5.8166" y1="1.1938" x2="-3.81" y2="1.1938" width="0.254" layer="21"/>
<wire x1="-3.81" y1="1.1938" x2="-2.3114" y2="1.1938" width="0.254" layer="21"/>
<wire x1="-5.3086" y1="-1.3208" x2="-5.8166" y2="-1.3208" width="0.254" layer="21"/>
<wire x1="-2.3114" y1="1.1938" x2="-5.3086" y2="-1.3208" width="0.1524" layer="21"/>
<wire x1="-2.3114" y1="1.1938" x2="-1.8034" y2="1.1938" width="0.254" layer="21"/>
<wire x1="-1.8034" y1="-1.3208" x2="-3.81" y2="-1.3208" width="0.254" layer="21"/>
<wire x1="-3.81" y1="-1.3208" x2="-3.81" y2="-2.0574" width="0.1524" layer="21"/>
<wire x1="-3.81" y1="-1.3208" x2="-5.3086" y2="-1.3208" width="0.254" layer="21"/>
<wire x1="16.51" y1="2.159" x2="16.51" y2="1.905" width="0.1524" layer="21"/>
<wire x1="15.24" y1="0.635" x2="15.5702" y2="0.9652" width="0.254" layer="21"/>
<wire x1="16.51" y1="-2.159" x2="16.51" y2="-1.905" width="0.1524" layer="21"/>
<wire x1="16.51" y1="-1.905" x2="15.5702" y2="-0.9398" width="0.1524" layer="21"/>
<wire x1="15.5702" y1="-0.9398" x2="11.43" y2="-0.9398" width="0.1524" layer="21"/>
<wire x1="15.5702" y1="-0.9398" x2="15.24" y2="-0.635" width="0.254" layer="21"/>
<wire x1="11.43" y1="-0.9398" x2="11.43" y2="-2.032" width="0.1524" layer="21"/>
<wire x1="17.4752" y1="-0.9398" x2="21.59" y2="-0.9398" width="0.1524" layer="21"/>
<wire x1="21.59" y1="-0.9398" x2="21.59" y2="-2.032" width="0.1524" layer="21"/>
<wire x1="15.5702" y1="0.9652" x2="11.43" y2="0.9652" width="0.1524" layer="21"/>
<wire x1="15.5702" y1="0.9652" x2="16.51" y2="1.905" width="0.254" layer="21"/>
<wire x1="11.43" y1="0.9652" x2="11.43" y2="1.9812" width="0.1524" layer="21"/>
<wire x1="17.4752" y1="0.9652" x2="21.59" y2="0.9652" width="0.1524" layer="21"/>
<wire x1="21.59" y1="0.9652" x2="21.59" y2="1.9812" width="0.1524" layer="21"/>
<wire x1="16.51" y1="2.794" x2="16.51" y2="2.159" width="0.1524" layer="51"/>
<wire x1="16.51" y1="-2.159" x2="16.51" y2="-2.794" width="0.1524" layer="51"/>
<pad name="2" x="-3.81" y="-3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="1" x="-3.81" y="3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="P2" x="16.51" y="3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="O1" x="11.43" y="-3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="S1" x="21.59" y="-3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="P1" x="16.51" y="-3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="O2" x="11.43" y="3.81" drill="1.3208" shape="long" rot="R90"/>
<pad name="S2" x="21.59" y="3.81" drill="1.3208" shape="long" rot="R90"/>
<text x="25.3746" y="-6.2992" size="1.778" layer="25" ratio="10" rot="R90">&gt;NAME</text>
<text x="1.778" y="-5.08" size="1.778" layer="27" ratio="10" rot="R90">&gt;VALUE</text>
</package>
</packages>
</library>
<library name="dp_devices">
<description>Dangerous Prototypes Standard PCB sizes
http://dangerousprototypes.com</description>
<packages>
<package name="TO-92">
<wire x1="-2.095" y1="-1.651" x2="2.095" y2="-1.651" width="0.1524" layer="21"/>
<wire x1="-2.413" y1="1.1359" x2="2.413" y2="1.1359" width="0.1524" layer="21" curve="-129.583345"/>
<wire x1="1.136" y1="-0.127" x2="-1.136" y2="-0.127" width="0.1524" layer="51"/>
<wire x1="-2.413" y1="1.1359" x2="-2.664" y2="-0.127" width="0.1524" layer="51" curve="27.937554"/>
<wire x1="-2.664" y1="-0.127" x2="-2.413" y2="-1.1359" width="0.1524" layer="51" curve="22.478763"/>
<wire x1="-1.404" y1="-0.127" x2="-2.664" y2="-0.127" width="0.1524" layer="51"/>
<wire x1="-2.4135" y1="-1.1359" x2="-2.095" y2="-1.651" width="0.1524" layer="21" curve="13.038528"/>
<wire x1="-1.136" y1="-0.127" x2="-1.404" y2="-0.127" width="0.1524" layer="21"/>
<wire x1="2.413" y1="-1.1359" x2="2.664" y2="-0.127" width="0.1524" layer="51" curve="22.478763"/>
<wire x1="2.664" y1="-0.127" x2="2.413" y2="1.1359" width="0.1524" layer="51" curve="27.937554"/>
<wire x1="2.664" y1="-0.127" x2="1.404" y2="-0.127" width="0.1524" layer="51"/>
<wire x1="1.404" y1="-0.127" x2="1.136" y2="-0.127" width="0.1524" layer="21"/>
<wire x1="2.095" y1="-1.651" x2="2.4247" y2="-1.1118" width="0.1524" layer="21" curve="13.609443"/>
<pad name="3" x="2.54" y="0" drill="0.8128" shape="long" rot="R90"/>
<pad name="1" x="-2.54" y="0" drill="0.8128" shape="long" rot="R90"/>
<pad name="2" x="0" y="0" drill="0.8128" shape="long" rot="R90"/>
<text x="-2.54" y="3.048" size="1.27" layer="25" font="vector" ratio="10">&gt;NAME</text>
<text x="-2.54" y="-3.302" size="1.27" layer="27" font="vector" ratio="10">&gt;VALUE</text>
</package>
</packages>
</library>
<library name="adafruit">
<packages>
<package name="0204/7">
<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;
type 0204, grid 7.5 mm</description>
<wire x1="3.81" y1="0" x2="2.921" y2="0" width="0.508" layer="51"/>
<wire x1="-3.81" y1="0" x2="-2.921" y2="0" width="0.508" layer="51"/>
<wire x1="-2.54" y1="0.762" x2="-2.286" y2="1.016" width="0.1524" layer="21" curve="-90"/>
<wire x1="-2.54" y1="-0.762" x2="-2.286" y2="-1.016" width="0.1524" layer="21" curve="90"/>
<wire x1="2.286" y1="-1.016" x2="2.54" y2="-0.762" width="0.1524" layer="21" curve="90"/>
<wire x1="2.286" y1="1.016" x2="2.54" y2="0.762" width="0.1524" layer="21" curve="-90"/>
<wire x1="-2.54" y1="-0.762" x2="-2.54" y2="0.762" width="0.1524" layer="21"/>
<wire x1="-2.286" y1="1.016" x2="-1.905" y2="1.016" width="0.1524" layer="21"/>
<wire x1="-1.778" y1="0.889" x2="-1.905" y2="1.016" width="0.1524" layer="21"/>
<wire x1="-2.286" y1="-1.016" x2="-1.905" y2="-1.016" width="0.1524" layer="21"/>
<wire x1="-1.778" y1="-0.889" x2="-1.905" y2="-1.016" width="0.1524" layer="21"/>
<wire x1="1.778" y1="0.889" x2="1.905" y2="1.016" width="0.1524" layer="21"/>
<wire x1="1.778" y1="0.889" x2="-1.778" y2="0.889" width="0.1524" layer="21"/>
<wire x1="1.778" y1="-0.889" x2="1.905" y2="-1.016" width="0.1524" layer="21"/>
<wire x1="1.778" y1="-0.889" x2="-1.778" y2="-0.889" width="0.1524" layer="21"/>
<wire x1="2.286" y1="1.016" x2="1.905" y2="1.016" width="0.1524" layer="21"/>
<wire x1="2.286" y1="-1.016" x2="1.905" y2="-1.016" width="0.1524" layer="21"/>
<wire x1="2.54" y1="-0.762" x2="2.54" y2="0.762" width="0.1524" layer="21"/>
<pad name="1" x="-3.81" y="0" drill="0.8128" diameter="1.6764" shape="octagon"/>
<pad name="2" x="3.81" y="0" drill="0.8128" diameter="1.6764" shape="octagon"/>
<text x="-2.54" y="1.2954" size="0.9906" layer="25" ratio="12">&gt;NAME</text>
<text x="-1.6256" y="-0.4826" size="0.9906" layer="27" ratio="12">&gt;VALUE</text>
<rectangle x1="2.54" y1="-0.254" x2="2.921" y2="0.254" layer="21"/>
<rectangle x1="-2.921" y1="-0.254" x2="-2.54" y2="0.254" layer="21"/>
</package>
<package name="1X2-3.5MM">
<wire x1="-3.4" y1="3.4" x2="-3.4" y2="-2.2" width="0.127" layer="21"/>
<wire x1="-3.4" y1="-2.2" x2="-3.4" y2="-3.6" width="0.127" layer="21"/>
<wire x1="-3.4" y1="-3.6" x2="3.6" y2="-3.6" width="0.127" layer="21"/>
<wire x1="3.6" y1="-3.6" x2="3.6" y2="-2.2" width="0.127" layer="21"/>
<wire x1="3.6" y1="-2.2" x2="3.6" y2="3.4" width="0.127" layer="21"/>
<wire x1="3.6" y1="3.4" x2="-3.4" y2="3.4" width="0.127" layer="21"/>
<wire x1="-3.4" y1="-2.2" x2="3.6" y2="-2.2" width="0.127" layer="21"/>
<pad name="1" x="1.8" y="0" drill="1" diameter="2.1844"/>
<pad name="2" x="-1.7" y="0" drill="1" diameter="2.1844"/>
<text x="3" y="5" size="1.27" layer="25" rot="R180">&gt;NAME</text>
</package>
<package name="1X03-CLEANBIG">
<pad name="1" x="-2.54" y="0" drill="1.016" diameter="1.6764" rot="R90"/>
<pad name="2" x="0" y="0" drill="1.016" diameter="1.6764" rot="R90"/>
<pad name="3" x="2.54" y="0" drill="1.016" diameter="1.6764" rot="R90"/>
<text x="-3.8862" y="1.8288" size="1.27" layer="25" ratio="10">&gt;NAME</text>
<text x="-3.81" y="-3.175" size="1.27" layer="27">&gt;VALUE</text>
<rectangle x1="-0.254" y1="-0.254" x2="0.254" y2="0.254" layer="51"/>
<rectangle x1="-2.794" y1="-0.254" x2="-2.286" y2="0.254" layer="51"/>
<rectangle x1="2.286" y1="-0.254" x2="2.794" y2="0.254" layer="51"/>
</package>
</packages>
</library>
</libraries>
<attributes>
</attributes>
<variantdefs>
</variantdefs>
<classes>
<class number="0" name="default" width="0" drill="0">
</class>
</classes>
<designrules name="default">
<description language="en">&lt;b&gt;EAGLE Design Rules&lt;/b&gt;
&lt;p&gt;
The default Design Rules have been set to cover
a wide range of applications. Your particular design
may have different requirements, so please make the
necessary adjustments and save your customized
design rules under a new name.
</description>
<param name="layerSetup" value="(1*16)"/>
<param name="mtCopper" value="0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm"/>
<param name="mtIsolate" value="1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm"/>
<param name="mdWireWire" value="8mil"/>
<param name="mdWirePad" value="8mil"/>
<param name="mdWireVia" value="8mil"/>
<param name="mdPadPad" value="8mil"/>
<param name="mdPadVia" value="8mil"/>
<param name="mdViaVia" value="8mil"/>
<param name="mdSmdPad" value="8mil"/>
<param name="mdSmdVia" value="8mil"/>
<param name="mdSmdSmd" value="8mil"/>
<param name="mdViaViaSameLayer" value="8mil"/>
<param name="mnLayersViaInSmd" value="2"/>
<param name="mdCopperDimension" value="40mil"/>
<param name="mdDrill" value="8mil"/>
<param name="mdSmdStop" value="0mil"/>
<param name="msWidth" value="10mil"/>
<param name="msDrill" value="0.6mm"/>
<param name="msMicroVia" value="9.99mm"/>
<param name="msBlindViaRatio" value="0.5"/>
<param name="rvPadTop" value="0.25"/>
<param name="rvPadInner" value="0.25"/>
<param name="rvPadBottom" value="0.25"/>
<param name="rvViaOuter" value="0.25"/>
<param name="rvViaInner" value="0.25"/>
<param name="rvMicroViaOuter" value="0.25"/>
<param name="rvMicroViaInner" value="0.25"/>
<param name="rlMinPadTop" value="10mil"/>
<param name="rlMaxPadTop" value="20mil"/>
<param name="rlMinPadInner" value="10mil"/>
<param name="rlMaxPadInner" value="20mil"/>
<param name="rlMinPadBottom" value="10mil"/>
<param name="rlMaxPadBottom" value="20mil"/>
<param name="rlMinViaOuter" value="8mil"/>
<param name="rlMaxViaOuter" value="20mil"/>
<param name="rlMinViaInner" value="8mil"/>
<param name="rlMaxViaInner" value="20mil"/>
<param name="rlMinMicroViaOuter" value="4mil"/>
<param name="rlMaxMicroViaOuter" value="20mil"/>
<param name="rlMinMicroViaInner" value="4mil"/>
<param name="rlMaxMicroViaInner" value="20mil"/>
<param name="psTop" value="-1"/>
<param name="psBottom" value="-1"/>
<param name="psFirst" value="-1"/>
<param name="psElongationLong" value="100"/>
<param name="psElongationOffset" value="100"/>
<param name="mvStopFrame" value="1"/>
<param name="mvCreamFrame" value="0"/>
<param name="mlMinStopFrame" value="4mil"/>
<param name="mlMaxStopFrame" value="4mil"/>
<param name="mlMinCreamFrame" value="0mil"/>
<param name="mlMaxCreamFrame" value="0mil"/>
<param name="mlViaStopLimit" value="0mil"/>
<param name="srRoundness" value="0"/>
<param name="srMinRoundness" value="0mil"/>
<param name="srMaxRoundness" value="0mil"/>
<param name="slThermalIsolate" value="10mil"/>
<param name="slThermalsForVias" value="0"/>
<param name="dpMaxLengthDifference" value="10mm"/>
<param name="dpGapFactor" value="2.5"/>
<param name="checkGrid" value="0"/>
<param name="checkAngle" value="0"/>
<param name="checkFont" value="1"/>
<param name="checkRestrict" value="1"/>
<param name="useDiameter" value="13"/>
<param name="maxErrors" value="999999"/>
</designrules>
<autorouter>
<pass name="Default">
<param name="RoutingGrid" value="50mil"/>
<param name="AutoGrid" value="1"/>
<param name="Efforts" value="0"/>
<param name="TopRouterVariant" value="1"/>
<param name="tpViaShape" value="round"/>
<param name="PrefDir.1" value="a"/>
<param name="PrefDir.2" value="0"/>
<param name="PrefDir.3" value="0"/>
<param name="PrefDir.4" value="0"/>
<param name="PrefDir.5" value="0"/>
<param name="PrefDir.6" value="0"/>
<param name="PrefDir.7" value="0"/>
<param name="PrefDir.8" value="0"/>
<param name="PrefDir.9" value="0"/>
<param name="PrefDir.10" value="0"/>
<param name="PrefDir.11" value="0"/>
<param name="PrefDir.12" value="0"/>
<param name="PrefDir.13" value="0"/>
<param name="PrefDir.14" value="0"/>
<param name="PrefDir.15" value="0"/>
<param name="PrefDir.16" value="a"/>
<param name="cfVia" value="8"/>
<param name="cfNonPref" value="5"/>
<param name="cfChangeDir" value="2"/>
<param name="cfOrthStep" value="2"/>
<param name="cfDiagStep" value="3"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="1"/>
<param name="cfMalusStep" value="1"/>
<param name="cfPadImpact" value="4"/>
<param name="cfSmdImpact" value="4"/>
<param name="cfBusImpact" value="0"/>
<param name="cfHugging" value="3"/>
<param name="cfAvoid" value="4"/>
<param name="cfPolygon" value="10"/>
<param name="cfBase.1" value="0"/>
<param name="cfBase.2" value="1"/>
<param name="cfBase.3" value="1"/>
<param name="cfBase.4" value="1"/>
<param name="cfBase.5" value="1"/>
<param name="cfBase.6" value="1"/>
<param name="cfBase.7" value="1"/>
<param name="cfBase.8" value="1"/>
<param name="cfBase.9" value="1"/>
<param name="cfBase.10" value="1"/>
<param name="cfBase.11" value="1"/>
<param name="cfBase.12" value="1"/>
<param name="cfBase.13" value="1"/>
<param name="cfBase.14" value="1"/>
<param name="cfBase.15" value="1"/>
<param name="cfBase.16" value="0"/>
<param name="mnVias" value="20"/>
<param name="mnSegments" value="9999"/>
<param name="mnExtdSteps" value="9999"/>
<param name="mnRipupLevel" value="10"/>
<param name="mnRipupSteps" value="100"/>
<param name="mnRipupTotal" value="100"/>
</pass>
<pass name="Follow-me" refer="Default" active="yes">
</pass>
<pass name="Busses" refer="Default" active="yes">
<param name="cfNonPref" value="4"/>
<param name="cfBusImpact" value="4"/>
<param name="cfHugging" value="0"/>
<param name="mnVias" value="0"/>
</pass>
<pass name="Route" refer="Default" active="yes">
</pass>
<pass name="Optimize1" refer="Default" active="yes">
<param name="cfVia" value="99"/>
<param name="cfExtdStep" value="10"/>
<param name="cfHugging" value="1"/>
<param name="mnExtdSteps" value="1"/>
<param name="mnRipupLevel" value="0"/>
</pass>
<pass name="Optimize2" refer="Optimize1" active="yes">
<param name="cfNonPref" value="0"/>
<param name="cfChangeDir" value="6"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="2"/>
<param name="cfMalusStep" value="2"/>
<param name="cfPadImpact" value="2"/>
<param name="cfSmdImpact" value="2"/>
<param name="cfHugging" value="0"/>
</pass>
<pass name="Optimize3" refer="Optimize2" active="yes">
<param name="cfChangeDir" value="8"/>
<param name="cfPadImpact" value="0"/>
<param name="cfSmdImpact" value="0"/>
</pass>
<pass name="Optimize4" refer="Optimize3" active="yes">
<param name="cfChangeDir" value="25"/>
</pass>
</autorouter>
<elements>
<element name="K1" library="relay" package="F4052" value="4052" x="44.45" y="7.62">
<attribute name="OC_NEWARK" value="unknown" x="44.45" y="7.62" size="1.778" layer="27" display="off"/>
<attribute name="MPN" value="" x="44.45" y="7.62" size="1.778" layer="27" display="off"/>
<attribute name="MF" value="" x="44.45" y="7.62" size="1.778" layer="27" display="off"/>
<attribute name="OC_FARNELL" value="unknown" x="44.45" y="7.62" size="1.778" layer="27" display="off"/>
</element>
<element name="Q1" library="dp_devices" package="TO-92" value="" x="25.4" y="3.81" rot="R270"/>
<element name="R1" library="adafruit" package="0204/7" value="" x="15.24" y="2.54"/>
<element name="J1" library="adafruit" package="1X2-3.5MM" value="1X2-3.5MM" x="3.81" y="20.32" smashed="yes" rot="R270"/>
<element name="R2" library="adafruit" package="0204/7" value="" x="15.24" y="7.62"/>
<element name="J2" library="adafruit" package="1X2-3.5MM" value="1X2-3.5MM" x="74.93" y="7.62" rot="R270"/>
<element name="JP1" library="adafruit" package="1X03-CLEANBIG" value="" x="5.08" y="5.08" smashed="yes" rot="R270">
<attribute name="NAME" x="6.2738" y="8.1788" size="1.27" layer="25" ratio="10"/>
<attribute name="VALUE" x="1.905" y="8.89" size="1.27" layer="27" rot="R270"/>
</element>
<element name="K2" library="relay" package="F4052" value="4052" x="39.37" y="21.59">
<attribute name="OC_NEWARK" value="unknown" x="39.37" y="21.59" size="1.778" layer="27" display="off"/>
<attribute name="MPN" value="" x="39.37" y="21.59" size="1.778" layer="27" display="off"/>
<attribute name="MF" value="" x="39.37" y="21.59" size="1.778" layer="27" display="off"/>
<attribute name="OC_FARNELL" value="unknown" x="39.37" y="21.59" size="1.778" layer="27" display="off"/>
</element>
<element name="Q2" library="dp_devices" package="TO-92" value="" x="25.4" y="11.43" rot="R90"/>
</elements>
<signals>
<signal name="N$1">
<contactref element="Q1" pad="2"/>
<contactref element="R1" pad="2"/>
<wire x1="19.05" y1="2.54" x2="20.32" y2="2.54" width="0.6096" layer="1"/>
<wire x1="20.32" y1="2.54" x2="22.86" y2="3.81" width="0.6096" layer="1"/>
<wire x1="22.86" y1="3.81" x2="25.4" y2="3.81" width="0.6096" layer="1"/>
</signal>
<signal name="+12V">
<contactref element="J1" pad="2"/>
<contactref element="K2" pad="1"/>
<contactref element="K1" pad="1"/>
<wire x1="3.81" y1="22.02" x2="3.81" y2="25.4" width="0.6096" layer="1"/>
<wire x1="3.81" y1="25.4" x2="35.56" y2="25.4" width="0.6096" layer="1"/>
<wire x1="35.56" y1="25.4" x2="40.64" y2="25.4" width="0.6096" layer="1"/>
<wire x1="40.64" y1="25.4" x2="40.64" y2="21.59" width="0.6096" layer="1"/>
<contactref element="K2" pad="P1"/>
<wire x1="40.64" y1="11.43" x2="40.64" y2="21.59" width="0.6096" layer="1"/>
<wire x1="40.64" y1="21.59" x2="55.88" y2="21.59" width="0.6096" layer="1"/>
<wire x1="55.88" y1="21.59" x2="55.88" y2="17.78" width="0.6096" layer="1"/>
</signal>
<signal name="GND">
<contactref element="Q1" pad="1"/>
<contactref element="J1" pad="1"/>
<contactref element="Q2" pad="1"/>
<contactref element="JP1" pad="2"/>
<wire x1="3.81" y1="18.52" x2="3.81" y2="16.51" width="0.6096" layer="16"/>
<wire x1="3.81" y1="16.51" x2="2.54" y2="15.24" width="0.6096" layer="16"/>
<wire x1="2.54" y1="15.24" x2="2.54" y2="5.08" width="0.6096" layer="16"/>
<wire x1="2.54" y1="5.08" x2="5.08" y2="5.08" width="0.6096" layer="16"/>
<wire x1="5.08" y1="5.08" x2="22.86" y2="5.08" width="0.6096" layer="16"/>
<wire x1="22.86" y1="5.08" x2="24.13" y2="6.35" width="0.6096" layer="16"/>
<wire x1="24.13" y1="6.35" x2="25.4" y2="6.35" width="0.6096" layer="16"/>
<wire x1="25.4" y1="6.35" x2="25.4" y2="8.89" width="0.6096" layer="16"/>
<contactref element="K1" pad="P2"/>
<wire x1="25.4" y1="8.89" x2="25.4" y2="7.62" width="0.6096" layer="16"/>
<wire x1="25.4" y1="7.62" x2="53.34" y2="7.62" width="0.6096" layer="16"/>
<wire x1="53.34" y1="7.62" x2="53.34" y2="13.97" width="0.6096" layer="16"/>
<wire x1="53.34" y1="13.97" x2="60.96" y2="13.97" width="0.6096" layer="16"/>
<wire x1="60.96" y1="13.97" x2="60.96" y2="11.43" width="0.6096" layer="16"/>
</signal>
<signal name="N$3">
<contactref element="R2" pad="2"/>
<contactref element="Q2" pad="2"/>
<wire x1="19.05" y1="7.62" x2="19.05" y2="11.43" width="0.6096" layer="1"/>
<wire x1="19.05" y1="11.43" x2="25.4" y2="11.43" width="0.6096" layer="1"/>
</signal>
<signal name="N$6">
<contactref element="K1" pad="S1"/>
<contactref element="J2" pad="1"/>
<contactref element="K1" pad="O2"/>
<wire x1="55.88" y1="11.43" x2="66.04" y2="3.81" width="0.6096" layer="16"/>
<wire x1="66.04" y1="3.81" x2="74.93" y2="5.82" width="0.6096" layer="1"/>
</signal>
<signal name="N$7">
<contactref element="J2" pad="2"/>
<contactref element="K1" pad="S2"/>
<contactref element="K1" pad="O1"/>
<wire x1="55.88" y1="3.81" x2="66.04" y2="11.43" width="0.6096" layer="1"/>
<wire x1="66.04" y1="11.43" x2="74.93" y2="9.32" width="0.6096" layer="1"/>
</signal>
<signal name="N$9">
<contactref element="R1" pad="1"/>
<contactref element="JP1" pad="3"/>
<wire x1="5.08" y1="2.54" x2="11.43" y2="2.54" width="0.6096" layer="1"/>
</signal>
<signal name="N$5">
<contactref element="JP1" pad="1"/>
<contactref element="R2" pad="1"/>
<wire x1="5.08" y1="7.62" x2="11.43" y2="7.62" width="0.6096" layer="1"/>
</signal>
<signal name="N$4">
<contactref element="Q2" pad="3"/>
<contactref element="K2" pad="2"/>
<wire x1="25.4" y1="13.97" x2="25.4" y2="17.78" width="0.6096" layer="1"/>
<wire x1="25.4" y1="17.78" x2="35.56" y2="17.78" width="0.6096" layer="1"/>
</signal>
<signal name="N$8">
<contactref element="Q1" pad="3"/>
<contactref element="K1" pad="2"/>
<wire x1="25.4" y1="1.27" x2="35.56" y2="1.27" width="0.6096" layer="1"/>
<wire x1="35.56" y1="1.27" x2="38.1" y2="3.81" width="0.6096" layer="1"/>
<wire x1="38.1" y1="3.81" x2="40.64" y2="3.81" width="0.6096" layer="1"/>
</signal>
<signal name="N$2">
<contactref element="K2" pad="S1"/>
<contactref element="K1" pad="P1"/>
<wire x1="60.96" y1="17.78" x2="58.42" y2="17.78" width="0.6096" layer="1"/>
<wire x1="58.42" y1="17.78" x2="58.42" y2="3.81" width="0.6096" layer="1"/>
<wire x1="58.42" y1="3.81" x2="60.96" y2="3.81" width="0.6096" layer="1"/>
</signal>
</signals>
</board>
</drawing>
</eagle>

File diff suppressed because it is too large Load Diff

View File

@ -6,24 +6,24 @@
#define DEBUG 1 #define DEBUG 1
byte addresses[][7] = {"ampBot", "ampCtl"}; byte addresses[][7] = {"ampBot","ampCtl"};
typedef enum { role_ping_out = 1, role_pong_back } role_e; // The various roles supported by this sketch typedef enum { role_ping_out = 1, role_pong_back } role_e; // The various roles supported by this sketch
role_e role ; role_e role ;
/** /**
Create a data structure for transmitting and receiving data * Create a data structure for transmitting and receiving data
This allows many variables to be easily sent and received in a single transmission * This allows many variables to be easily sent and received in a single transmission
See http://www.cplusplus.com/doc/tutorial/structures/ * See http://www.cplusplus.com/doc/tutorial/structures/
*/ */
struct dataStruct { struct dataStruct{
unsigned long _micros; unsigned long _micros;
int xin; int xin;
int yin; int yin;
} myData; }myData;
RF24 radio(9, 8); //also miso/mosi at 11/12/13 RF24 radio(9,8); //also miso/mosi at 11/12/13
#define role_pin 2 #define role_pin 2
/////// remote ///////////// /////// remote /////////////
#define AX_pin A0 #define AX_pin A0
@ -53,7 +53,7 @@ void setup() {
radio.openReadingPipe(1, addresses[0]); radio.openReadingPipe(1, addresses[0]);
radio.startListening(); radio.startListening();
if (DEBUG) Serial << "im a bot!" << endl; if(DEBUG) Serial << "im a bot!" << endl;
} else { } else {
role = role_ping_out; role = role_ping_out;
@ -61,10 +61,10 @@ void setup() {
radio.openReadingPipe(1, addresses[1]); radio.openReadingPipe(1, addresses[1]);
radio.stopListening(); radio.stopListening();
if (DEBUG) Serial << "im a controller!" << endl; if(DEBUG) Serial << "im a controller!" << endl;
} }
if (role == role_pong_back) if(role==role_pong_back)
{ {
// Initialize motor pins as outputs // Initialize motor pins as outputs
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
@ -79,7 +79,7 @@ void setup() {
digitalWrite(inApin[i], LOW); digitalWrite(inApin[i], LOW);
digitalWrite(inBpin[i], LOW); digitalWrite(inBpin[i], LOW);
} }
} else if (role == role_ping_out) { }else if(role == role_ping_out){
pinMode(AX_pin, INPUT); pinMode(AX_pin, INPUT);
pinMode(AY_pin, INPUT); pinMode(AY_pin, INPUT);
} }
@ -87,18 +87,16 @@ void setup() {
void loop() { void loop() {
/****************** Ping Out Role ***************************/ /****************** Ping Out Role ***************************/
if (role == role_ping_out) { if (role == role_ping_out) {
myData.xin = analogRead(AX_pin); myData.xin = analogRead(AX_pin);
if (myData.xin == 517) { if(myData.xin == 517){ myData.xin = 518;} //terrible hack.
myData.xin = 518; //terrible hack.
}
myData.yin = analogRead(AY_pin); myData.yin = analogRead(AY_pin);
bool ok = radio.write( &myData, sizeof(myData) ); bool ok = radio.write( &myData, sizeof(myData) );
if (DEBUG) Serial << "xin:" << myData.xin << " yin:" << myData.yin << endl; if(DEBUG) Serial<<"xin:"<<myData.xin<<" yin:"<<myData.yin<<endl;
/* /*
if (ok) if (ok)
Serial << "transfer OK \n\r"; Serial << "transfer OK \n\r";
@ -109,12 +107,12 @@ void loop() {
/****************** Pong Back Role ***************************/ /****************** Pong Back Role ***************************/
else if ( role == role_pong_back ) else if ( role == role_pong_back )
{ {
if ( radio.available()) { if( radio.available()){
// Variable for the received timestamp // Variable for the received timestamp
while (radio.available()) { // While there is data ready while (radio.available()) { // While there is data ready
radio.read( &myData, sizeof(myData) ); // Get the payload radio.read( &myData, sizeof(myData) ); // Get the payload
@ -126,19 +124,18 @@ void loop() {
leftMotorSpeed = constrain(y2pwm + x2pwm, -255, 255); leftMotorSpeed = constrain(y2pwm + x2pwm, -255, 255);
rightMotorSpeed = constrain(y2pwm - x2pwm, -255, 255); rightMotorSpeed = constrain(y2pwm - x2pwm, -255, 255);
move(1, rightMotorSpeed); if (myData.xin == 518 )
stop(0);
else
move(0, leftMotorSpeed); move(0, leftMotorSpeed);
if (myData.xin == 518 && myData.yin == 521) { if (myData.yin == 521)
stop(0);
stop(1); stop(1);
if (DEBUG) Serial << "im down:" << endl; else
move(1, rightMotorSpeed);
} else { if(DEBUG) Serial<<"left:"<<leftMotorSpeed<<" right:"<<rightMotorSpeed<<endl; delay(4);
if (DEBUG) Serial << "left:" << leftMotorSpeed << " right:" << rightMotorSpeed << endl; if(DEBUG) Serial<<"x:"<<myData.xin<<" y:"<<myData.yin<<endl; delay(4);
if (DEBUG) Serial << "inY :" << myData.yin << " inX:" << myData.xin << endl;
}
delay(4);
} }
} }
@ -154,7 +151,7 @@ void move(int motor, int speed) {
digitalWrite(inApin[motor], HIGH); digitalWrite(inApin[motor], HIGH);
digitalWrite(inBpin[motor], LOW); digitalWrite(inBpin[motor], LOW);
} }
else { else{
digitalWrite(inApin[motor], LOW); digitalWrite(inApin[motor], LOW);
digitalWrite(inBpin[motor], HIGH); digitalWrite(inBpin[motor], HIGH);
} }