Files
Embedded-Hacking/WEEK10/slides/WEEK10-IMG02.svg
T
Kevin Thomas 6a9090915b Initial commit
2026-07-06 21:23:12 -04:00

90 lines
4.3 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
<style>
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
.dim{font:20px 'Courier New',monospace;fill:#888}
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
.badge{stroke:#00ff41;rx:14}
</style>
<rect class="bg" width="1200" height="800"/>
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
<text class="title" x="600" y="52" text-anchor="middle">Static Conditionals</text>
<text class="dim" x="600" y="88" text-anchor="middle">Fixed Outcome -- Same Path Every Time</text>
<!-- Code -->
<rect class="pnl" x="30" y="110" width="555" height="320" rx="8"/>
<text class="sub" x="50" y="150">Static Code Pattern</text>
<rect x="50" y="170" width="515" height="240" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
<text class="cyn" x="70" y="200">int choice = 1;</text>
<text class="dim" x="370" y="200">// NEVER changes</text>
<text class="txt" x="70" y="235">while (true) {</text>
<text class="txt" x="100" y="270">if (choice == 1)</text>
<text class="grn" x="130" y="300">printf("1");</text>
<text class="txt" x="100" y="330">else if (choice == 2)</text>
<text class="red" x="130" y="360">printf("2");</text>
<text class="dim" x="370" y="360">// dead code</text>
<text class="txt" x="100" y="390">else</text>
<!-- Flow Diagram -->
<rect class="pnl" x="615" y="110" width="555" height="320" rx="8"/>
<text class="sub" x="635" y="150">Execution Flow</text>
<rect x="680" y="175" width="190" height="40" rx="6" fill="#0a0a0f" stroke="#00d4ff"/>
<text class="cyn" x="690" y="202">choice == 1?</text>
<line x1="870" y1="195" x2="910" y2="195" stroke="#00ff41" stroke-width="2"/>
<text class="grn" x="915" y="202">YES</text>
<rect x="980" y="175" width="150" height="40" rx="6" fill="#0a0a0f" stroke="#00ff41"/>
<text class="grn" x="1055" y="202" text-anchor="middle">print "1"</text>
<text class="red" x="790" y="245">NO (never taken)</text>
<line x1="775" y1="215" x2="775" y2="255" stroke="#ff0040" stroke-width="1" stroke-dasharray="4"/>
<rect x="680" y="260" width="190" height="40" rx="6" fill="#0a0a0f" stroke="#1a1a2e" stroke-dasharray="4"/>
<text class="dim" x="710" y="287">choice == 2?</text>
<text class="dim" x="700" y="330">NO (never reached)</text>
<rect x="680" y="345" width="190" height="40" rx="6" fill="#0a0a0f" stroke="#1a1a2e" stroke-dasharray="4"/>
<text class="dim" x="710" y="372">print "?"</text>
<text class="dim" x="635" y="415">Only ONE path ever executes!</text>
<!-- Execution Trace -->
<rect class="pnl" x="30" y="450" width="1140" height="120" rx="8"/>
<text class="sub" x="50" y="490">Every Loop Iteration (Always the Same)</text>
<text class="grn" x="50" y="525">1. if(1==1) --> TRUE</text>
<text class="grn" x="450" y="525">2. print "1"</text>
<text class="grn" x="720" y="525">3. switch(1) case 1</text>
<text class="grn" x="50" y="555">4. print "one"</text>
<text class="grn" x="350" y="555">5. servo 0deg</text>
<text class="grn" x="620" y="555">6. sleep 500ms</text>
<text class="grn" x="900" y="555">7. servo 180deg</text>
<!-- Serial Output -->
<rect class="pnl" x="30" y="590" width="555" height="170" rx="8"/>
<text class="sub" x="50" y="630">Serial Output (Forever)</text>
<rect x="50" y="645" width="515" height="95" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
<text class="grn" x="70" y="675">1</text>
<text class="grn" x="70" y="700">one</text>
<text class="grn" x="70" y="725">1</text>
<text class="dim" x="150" y="700">// repeats forever</text>
<!-- Servo -->
<rect class="pnl" x="615" y="590" width="555" height="170" rx="8"/>
<text class="sub" x="635" y="630">Servo Motion (Forever)</text>
<text class="txt" x="635" y="670">0deg</text>
<text class="amb" x="730" y="670">--></text>
<text class="txt" x="800" y="670">180deg</text>
<text class="amb" x="920" y="670">--></text>
<text class="txt" x="990" y="670">0deg</text>
<text class="dim" x="635" y="705">Sweeps back and forth, 500ms each</text>
<text class="dim" x="635" y="735">Continuous, predictable motion</text>
</svg>