https://wiki.badge.team/index.php?title=SHA2017Badge/Emulator&feed=atom&action=history
SHA2017Badge/Emulator - Revision history
2024-03-29T01:07:24Z
Revision history for this page on the wiki
MediaWiki 1.33.0
https://wiki.badge.team/index.php?title=SHA2017Badge/Emulator&diff=10&oldid=prev
AnneJan at 13:10, 15 January 2019
2019-01-15T13:10:27Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:10, 15 January 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l67" >Line 67:</td>
<td colspan="2" class="diff-lineno">Line 67:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki>./micropython demo.py</nowiki></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki>./micropython demo.py</nowiki></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[File:SHA2017Badge emulator.jpg|thumb|SHA2017Badge emulator running Mandelbrod]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[File:SHA2017Badge emulator.jpg|thumb|SHA2017Badge emulator running Mandelbrod]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>You can also just start <code>./micropython</code> and start using the [[<del class="diffchange diffchange-inline">Projects:Badge</del>/MicroPython|MicroPython modules]].</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>You can also just start <code>./micropython</code> and start using the [[<ins class="diffchange diffchange-inline">SHA2017Badge</ins>/MicroPython|MicroPython modules]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki>import ugfx</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki>import ugfx</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l93" >Line 93:</td>
<td colspan="2" class="diff-lineno">Line 93:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></nowiki></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></nowiki></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>You can also use [[<del class="diffchange diffchange-inline">Projects:Badge</del>/woezel|woezel]] to install software from the [[<del class="diffchange diffchange-inline">Projects:Badge</del>/Hatchery|Hatchery]].</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>You can also use [[<ins class="diffchange diffchange-inline">SHA2017Badge</ins>/woezel|woezel]] to install software from the [[<ins class="diffchange diffchange-inline">SHA2017Badge</ins>/Hatchery|Hatchery]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki>import woezel</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki>import woezel</div></td></tr>
</table>
AnneJan
https://wiki.badge.team/index.php?title=SHA2017Badge/Emulator&diff=8&oldid=prev
AnneJan: Created page with "==Badge Emulator== You can now play with the badge software before you even receive your badge! ==Limitations== Apparently key-presses etc can only be caught while actively..."
2019-01-15T13:03:53Z
<p>Created page with "==Badge Emulator== You can now play with the badge software before you even receive your badge! ==Limitations== Apparently key-presses etc can only be caught while actively..."</p>
<p><b>New page</b></p><div>==Badge Emulator==<br />
You can now play with the badge software before you even receive your badge!<br />
<br />
==Limitations==<br />
<br />
Apparently key-presses etc can only be caught while actively waiting.<br />
Might not be much of a limitation.<br />
<br />
==Keys==<br />
<br />
Arrow keys: UP, DOWN, LEFT, RIGHT<br />
<br />
PageUP: A<br />
<br />
PageDown: B<br />
<br />
Home: Select<br />
<br />
End: Start<br />
<br />
Delete: Flash<br />
<br />
Enter: Middle (unused)<br />
<br />
==Installation==<br />
<br />
===Debian-based GNU/Linux===<br />
<nowiki>sudo apt-get install libncurses5-dev flex bison gperf python-serial libffi-dev libsdl2-dev libmbedtls-dev</nowiki><br />
Or equivalent installation of requirements on your distribution.<br />
<nowiki>git clone --recursive https://github.com/SHA2017-badge/Firmware.git<br />
cd Firmware/micropython/unix<br />
make</nowiki><br />
<br />
===Arch-Linux===<br />
<nowiki>git clone --recursive https://github.com/SHA2017-badge/Firmware.git<br />
cd Firmware/micropython/unix<br />
git clone https://github.com/ARMmbed/mbedtls.git<br />
cd mbedtls<br />
make<br />
sudo make install<br />
cd ..<br />
make</nowiki><br />
<br />
===NixOS===<br />
<nowiki>git clone --recursive https://github.com/SHA2017-badge/Firmware.git<br />
cd Firmware/micropython/unix<br />
nix-shell --packages gcc ncurses5 flex bison2 gperf \<br />
python35Packages.pyserial libffi SDL2 mbedtls \<br />
--pure --command make</nowiki><br />
<br />
===macOS===<br />
<nowiki>git clone --recursive https://github.com/SHA2017-badge/Firmware.git<br />
cd Firmware/micropython/lib<br />
git clone https://github.com/ARMmbed/mbedtls.git<br />
cd mbedtls<br />
make<br />
sudo make install<br />
cd ../../unix<br />
make</nowiki><br />
<br />
''if you get an error that sdl2-config is missing (/usr/local/bin/sdl2-config: No such file or directory), you can install it using e.g. homebrew, like this:''<br />
brew install SDL2<br />
<br />
Older macOS installs have some missing headers: https://github.com/SHA2017-badge/Firmware/issues/99<br />
<br />
==Usage==<br />
<nowiki>./micropython demo.py</nowiki><br />
[[File:SHA2017Badge emulator.jpg|thumb|SHA2017Badge emulator running Mandelbrod]]<br />
You can also just start <code>./micropython</code> and start using the [[Projects:Badge/MicroPython|MicroPython modules]].<br />
<nowiki>import ugfx<br />
<br />
ugfx.init()<br />
<br />
ugfx.clear(ugfx.BLACK)<br />
<br />
ugfx.fill_circle(60, 60, 50, ugfx.WHITE);<br />
ugfx.fill_circle(60, 60, 40, ugfx.BLACK);<br />
ugfx.fill_circle(60, 60, 30, ugfx.WHITE);<br />
ugfx.fill_circle(60, 60, 20, ugfx.BLACK);<br />
ugfx.fill_circle(60, 60, 10, ugfx.WHITE);<br />
<br />
ugfx.thickline(1,1,100,100,ugfx.WHITE,10,5)<br />
ugfx.box(30,30,50,50,ugfx.WHITE)<br />
<br />
ugfx.string(150,25,"STILL","Roboto_BlackItalic24",ugfx.WHITE)<br />
ugfx.string(130,50,"Hacking","PermanentMarker22",ugfx.WHITE)<br />
len = ugfx.get_string_width("Hacking","PermanentMarker22")<br />
ugfx.line(130, 72, 144 + len, 72, ugfx.WHITE)<br />
ugfx.line(140 + len, 52, 140 + len, 70, ugfx.WHITE)<br />
ugfx.string(140,75,"Anyway","Roboto_BlackItalic24",ugfx.WHITE)<br />
<br />
ugfx.flush()<br />
</nowiki><br />
<br />
You can also use [[Projects:Badge/woezel|woezel]] to install software from the [[Projects:Badge/Hatchery|Hatchery]].<br />
<br />
<nowiki>import woezel<br />
woezel.install('game_of_life')<br />
import game_of_life</nowiki><br />
<br />
[[File:Badge emulator macOS.png|800px|frameless|center|woezel.install('game_of_life')]]</div>
AnneJan