mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-12 23:26:33 +02:00
51 lines
2.5 KiB
XML
51 lines
2.5 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">Dynamic Source Code</text>
|
|
<text class="dim" x="600" y="88" text-anchor="middle">0x0020_dynamic-conditionals.c</text>
|
|
|
|
<!-- Source Code -->
|
|
<rect class="pnl" x="30" y="110" width="1140" height="530" rx="8"/>
|
|
<text class="sub" x="50" y="150">Full Source</text>
|
|
<rect x="50" y="170" width="1100" height="450" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
|
|
|
<text class="dim" x="70" y="200">#include <stdio.h></text>
|
|
<text class="dim" x="70" y="225">#include "pico/stdlib.h"</text>
|
|
<text class="dim" x="70" y="250">#include "servo.h"</text>
|
|
<text class="cyn" x="70" y="280">#define SERVO_GPIO 6</text>
|
|
|
|
<text class="cyn" x="70" y="315">int main(void) {</text>
|
|
<text class="txt" x="100" y="345">stdio_init_all();</text>
|
|
<text class="amb" x="100" y="375">uint8_t choice = 0;</text>
|
|
<text class="dim" x="430" y="375">// DYNAMIC!</text>
|
|
<text class="txt" x="100" y="405">servo_init(SERVO_GPIO);</text>
|
|
|
|
<text class="txt" x="100" y="440">while (true) {</text>
|
|
<text class="amb" x="130" y="470">choice = getchar();</text>
|
|
<text class="dim" x="430" y="470">// wait for input</text>
|
|
<text class="txt" x="130" y="500">if (choice == 0x31)</text>
|
|
<text class="dim" x="430" y="500">// '1'</text>
|
|
<text class="grn" x="160" y="530">printf("1\r\n");</text>
|
|
<text class="txt" x="130" y="560">else if (choice == 0x32)</text>
|
|
<text class="dim" x="430" y="560">// '2'</text>
|
|
<text class="grn" x="160" y="590">printf("2\r\n");</text>
|
|
|
|
<!-- switch block with servo -->
|
|
<rect class="pnl" x="30" y="660" width="1140" height="100" rx="8"/>
|
|
<text class="sub" x="50" y="695">switch Block (with servo control)</text>
|
|
<text class="txt" x="50" y="730">case '1': print "one", servo 0-->180, sleep 500ms</text>
|
|
<text class="txt" x="50" y="750">case '2': print "two", servo 180-->0, sleep 500ms</text>
|
|
</svg>
|