update
@ -10,7 +10,7 @@ BUILDDIR = build
|
||||
SPHINXAUTOBUILD = sphinx-autobuild
|
||||
|
||||
livehtml:
|
||||
@$(SPHINXAUTOBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
|
||||
@$(SPHINXAUTOBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port 9001
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Werkplaats Realiseren</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#periode-3">Periode 3</a></li>
|
||||
@ -104,7 +105,7 @@ op een idee te presenteren gebaseerd op huidig beschikbare informatie en vroegti
|
||||
<p>Voor de metingen nam ik de moeite de meet locatie te verkennen en uit te beelden op een schema voor een uiteindelijk verslag. Hiermee konden de partijen ook de locatie van hun
|
||||
meetappartuur vroegtijdig aangeven. Verder zocht ik (tervegeefs) contact met de aandeelhouders maar dit werdt later door een leraar verholpen sinds alle groepjes hier problemen
|
||||
mee hadden.</p>
|
||||
<img alt="werkplaats_realiseren/diagramperiod3.png" src="werkplaats_realiseren/diagramperiod3.png" />
|
||||
<img alt="_images/diagramperiod3.png" src="_images/diagramperiod3.png" />
|
||||
<p>Voor deze periode had ik een prototype bedacht dat om de gebruikers te meten aan de hand van bluetooth signalen in een 5-10 meter radius dat gebruik maakte van het slechte
|
||||
signaal in de toiletten en wat positionering. Voor dit prototype dacht ik eerst de hc-05 bluetooth module voor te gebruiken maar ik had voor de veiligheid 2 esp32 firebeetle
|
||||
bordjes gekocht die niet afhankelijk waren van een externe sensor om bluetooth signalen op te pikken. Onthoud dat op dit punt was het meer een paper prototype dan een solide
|
||||
|
@ -47,6 +47,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -85,25 +86,18 @@
|
||||
|
||||
<section id="stage-internship">
|
||||
<h1>Stage/Internship<a class="headerlink" href="#stage-internship" title="Permalink to this heading"></a></h1>
|
||||
<p>Voor Jaar 2 Periode 2 moeten de studenten een stage vinden en lopen. De eerste stage is een meewerkstage waar de student moet leren in een werkomgeving te presteren en een idee
|
||||
te krijgen over hun werk in de praktijk. De “tweede” stage is een afstudeerstage die vanaf periode 3 tot 4 duurt waarbij de student een afstudeeropdracht moet maken bij het
|
||||
bedrijf waar ze stage lopen. De stages mogen en kunnen bij een bedrijf worden uitgevoerd maar de student wordt verwacht zelf contact te leggen met een bedrijf en een stage te
|
||||
regelen.</p>
|
||||
<p>Voor Jaar 2 Periode 2 moeten de studenten een stage vinden. Dit traject is verdeeld in twee stages waar de student wordt getoetst op alles wat hij/zij heeft geleerd in de studie
|
||||
en moet uiteindelijk op basis van deze stage slagen voor de opleiding. De stage is officieel verdeeld in twee stages maar kan op een adres worden gelopen mits het bedrijf de
|
||||
student kan begeleiden op basis van de studie.</p>
|
||||
<section id="meewerkstage">
|
||||
<h2>meewerkstage<a class="headerlink" href="#meewerkstage" title="Permalink to this heading"></a></h2>
|
||||
<p>De meewerkstage is de warmup van hoe het jaar er uit gaat zien voor de studenten en zoals met de meeste opdrachten die de studenten hebben gedaan in het vorige jaar is dit het
|
||||
“makkelijke” deel voordat net zoals met andere vakken de volgende opdracht een veel uitdagendere variant is van dezelfde opdracht. Een simpel voorbeeld hiervan is jaar 2 periode 1:
|
||||
In deze periode moet de student laten zien dat hij een stage kan bemachtigen, enkel dit voor een vak. Nu voor periode 2 moet de student bij deze stageplek meelopen op de werkvloer.
|
||||
Periode 3-4 zijn gelijk geclusterd en vragen (als de student geen geschikte stageplek heeft gekozen) het process van periode 1 en 2 opnieuw uit te voeren en daarbij ook op eigen
|
||||
initiatief een afstudeeropdracht te bedenken, uit te voeren door meerdere vakken te herhalen zoals de werkplaats en User Experience in een kwestie van 2 periodes met een tijdslimiet.</p>
|
||||
<p>De eerste stage: dit wordt toegevoegd zodra ik een stage heb</p>
|
||||
<p>De meewerkstage is bedoeld om studenten ervaring te laten op doen op de werkvloer als een echte baan. Deze stage duurt voor de gehele duratie van waar de student stage loopt
|
||||
en tijdens deze stage wordt er verwacht dat de student meedraait als een reguliere werknemer in het bedrijf. Wat wel van belang is tijdens deze stage is het zoeken naar een
|
||||
afstudeercasus om de afstudeerstage te kunnen starten in de 3e periode van het studiejaar.</p>
|
||||
</section>
|
||||
<section id="afstudeerstage">
|
||||
<h2>Afstudeerstage<a class="headerlink" href="#afstudeerstage" title="Permalink to this heading"></a></h2>
|
||||
<p>De afstudeerstage is zoals voorheen benoemd 3-4 vakken in een blender gedeponeerd, gemixt met aceton en geinjecteerd met steroids: De student moet als hij geen gepaste stage had
|
||||
in periode 2 een nieuwe stage vinden en in het bedrijf meedraaien terwijl de student ook een afstudeeropdracht moet bedenken waarbij de student een verbetering/contributie voor
|
||||
het bedrijf moet bedenken, ontwerpen en bouwen tot een prototype. Dit is ook praktisch de finale opdracht van de studie waar de student alles wat ze hebben geleerd moeten
|
||||
gebruiken om te laten zien das ze HBO en IoT materiaal zijn.</p>
|
||||
<p>Voor de afstudeerstage moet de student een casus vinden binnen het bedrijf dat de student mogelijk kan oplossen met IoT.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
BIN
documentation/build/_images/oneshot_pwdgen.png
Normal file
After Width: | Height: | Size: 28 KiB |
@ -21,7 +21,7 @@ Voor de metingen nam ik de moeite de meet locatie te verkennen en uit te beelden
|
||||
meetappartuur vroegtijdig aangeven. Verder zocht ik (tervegeefs) contact met de aandeelhouders maar dit werdt later door een leraar verholpen sinds alle groepjes hier problemen
|
||||
mee hadden.
|
||||
|
||||
.. image:: werkplaats_realiseren/diagram period 3.png
|
||||
.. image:: werkplaats_realiseren/diagramperiod3.png
|
||||
|
||||
Voor deze periode had ik een prototype bedacht dat om de gebruikers te meten aan de hand van bluetooth signalen in een 5-10 meter radius dat gebruik maakte van het slechte
|
||||
signaal in de toiletten en wat positionering. Voor dit prototype dacht ik eerst de hc-05 bluetooth module voor te gebruiken maar ik had voor de veiligheid 2 esp32 firebeetle
|
||||
|
@ -2,26 +2,18 @@
|
||||
Stage/Internship
|
||||
****************
|
||||
|
||||
Voor Jaar 2 Periode 2 moeten de studenten een stage vinden en lopen. De eerste stage is een meewerkstage waar de student moet leren in een werkomgeving te presteren en een idee
|
||||
te krijgen over hun werk in de praktijk. De "tweede" stage is een afstudeerstage die vanaf periode 3 tot 4 duurt waarbij de student een afstudeeropdracht moet maken bij het
|
||||
bedrijf waar ze stage lopen. De stages mogen en kunnen bij een bedrijf worden uitgevoerd maar de student wordt verwacht zelf contact te leggen met een bedrijf en een stage te
|
||||
regelen.
|
||||
Voor Jaar 2 Periode 2 moeten de studenten een stage vinden. Dit traject is verdeeld in twee stages waar de student wordt getoetst op alles wat hij/zij heeft geleerd in de studie
|
||||
en moet uiteindelijk op basis van deze stage slagen voor de opleiding. De stage is officieel verdeeld in twee stages maar kan op een adres worden gelopen mits het bedrijf de
|
||||
student kan begeleiden op basis van de studie.
|
||||
|
||||
meewerkstage
|
||||
------------
|
||||
|
||||
De meewerkstage is de warmup van hoe het jaar er uit gaat zien voor de studenten en zoals met de meeste opdrachten die de studenten hebben gedaan in het vorige jaar is dit het
|
||||
"makkelijke" deel voordat net zoals met andere vakken de volgende opdracht een veel uitdagendere variant is van dezelfde opdracht. Een simpel voorbeeld hiervan is jaar 2 periode 1:
|
||||
In deze periode moet de student laten zien dat hij een stage kan bemachtigen, enkel dit voor een vak. Nu voor periode 2 moet de student bij deze stageplek meelopen op de werkvloer.
|
||||
Periode 3-4 zijn gelijk geclusterd en vragen (als de student geen geschikte stageplek heeft gekozen) het process van periode 1 en 2 opnieuw uit te voeren en daarbij ook op eigen
|
||||
initiatief een afstudeeropdracht te bedenken, uit te voeren door meerdere vakken te herhalen zoals de werkplaats en User Experience in een kwestie van 2 periodes met een tijdslimiet.
|
||||
|
||||
De eerste stage: dit wordt toegevoegd zodra ik een stage heb
|
||||
De meewerkstage is bedoeld om studenten ervaring te laten op doen op de werkvloer als een echte baan. Deze stage duurt voor de gehele duratie van waar de student stage loopt
|
||||
en tijdens deze stage wordt er verwacht dat de student meedraait als een reguliere werknemer in het bedrijf. Wat wel van belang is tijdens deze stage is het zoeken naar een
|
||||
afstudeercasus om de afstudeerstage te kunnen starten in de 3e periode van het studiejaar.
|
||||
|
||||
Afstudeerstage
|
||||
--------------
|
||||
|
||||
De afstudeerstage is zoals voorheen benoemd 3-4 vakken in een blender gedeponeerd, gemixt met aceton en geinjecteerd met steroids: De student moet als hij geen gepaste stage had
|
||||
in periode 2 een nieuwe stage vinden en in het bedrijf meedraaien terwijl de student ook een afstudeeropdracht moet bedenken waarbij de student een verbetering/contributie voor
|
||||
het bedrijf moet bedenken, ontwerpen en bouwen tot een prototype. Dit is ook praktisch de finale opdracht van de studie waar de student alles wat ze hebben geleerd moeten
|
||||
gebruiken om te laten zien das ze HBO en IoT materiaal zijn.
|
||||
Voor de afstudeerstage moet de student een casus vinden binnen het bedrijf dat de student mogelijk kan oplossen met IoT.
|
@ -4,23 +4,17 @@ Ithamar's Agenda
|
||||
Tabel van opdrachten
|
||||
|
||||
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Wat | Wanneer | Opmerking | Status |
|
||||
+=============================+=================================+==================================================+========+
|
||||
|| || || || |
|
||||
|| || || || |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| HerExamen 2 SQLite | ????? | lees dit keer iets meer door | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Nederlands her-Examen 3 | ???? | | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Stage + opdracht | januari | moet voor periode 3 januri geregeld zijn | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Afstudeerstage + opdracht | 20 januari | vereist voor het cijfer van SQLite | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Keuzevak voor jaar 2 | 2023-2024 | opmaak voor gefaald zorgrobot, japans misschien? | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Haal firebeetle op van paul | 4 september 2023 - 28 juli 2024 | uitleensel | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Fnaf movie october | 27 october | Groep/solo uitje | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Wat | Wanneer | Opmerking | Status |
|
||||
+====================+============+===================+=========+
|
||||
|| || || || |
|
||||
|| || || || |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Krane impact | 01/07/2024 | Fall Ost | Ongoing |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| internship essay | september | initial defeat | Ongoing |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Workplace Research | ??? | Last man standing | tbd |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Zenoh casus | ??? | initiative | tbd |
|
||||
+--------------------+------------+-------------------+---------+
|
@ -35,21 +35,36 @@ Cijferlijst
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| studieloopbaancoaching 1 | Voldoende | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Data | 9.0 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| RSP | 8.5 | 4 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| UX | 5.5 | 4 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Ethiek | 8.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Cisco Intergraal | 8.8 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Data | 9.0 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Design research | 8.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| slc final assesment | 7.0 | 5 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| State of the art 1 | 9.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| State of the art 2 | 9.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
|
||||
************
|
||||
herkansingen
|
||||
************
|
||||
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| Vak | Cijfer | studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| User Experience | 5.2 | 4 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| SQLite | 4.2 | 2 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| zorgrobot | 5.0 | 2 studiepunten | Keuzevak (niet voor herhaling vatbaar) |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| OP2 studieloopbaancoaching | Onvoldoende | 2 studiepunten | Forgor thrice, couldn't redo b4 new year |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| Nederlands | 5.3 | 2 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
| Vak | Cijfer | studiepunten | |
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
| | | | |
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
@ -3,36 +3,43 @@ escape-room ithamar
|
||||
*******************
|
||||
Documentatie voor ithamar's escaperoom.
|
||||
|
||||
Voor jaar 1 periode 2 van mijn studie IoT moet ik een escaperoom maken met een arduino in een groepje. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de werkplaats arduino.
|
||||
Voor jaar 1 periode 2 van de studie Internet of Things moeten de studenten in een groepje een escaperoom maken met arduino's. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de periode bij het vak 'werkplaats arduino' om creativiteit en affiniteit te demonstreren binnen het vak.
|
||||
|
||||
Het groepje waarbij ik zit heeft als thema: horror, ondanks dit thema is de echte horror een doos vinden om de escaperoom uit te maken
|
||||
en op tijd de puzzles te maken en te kunnen verwerken in deze doos.
|
||||
Het groepje waarbij ik zat heeft als thema: horror, het denkproces achter dit thema is om een authentieke escaperoom te imiteren door de puzzels op een logische manier op elkaar te laten
|
||||
aansluiten. Het concept achter de escaperoom was om een doos te bouwen uit plywood en de 4 horizontale zijdes te gebruiken om de puzzels in te bouwen en zo klokwijs op elkaar aan te sluiten.
|
||||
|
||||
De puzzel die ik wil maken is afgeleid van de `oneshot color puzzle <https://www.youtube.com/watch?v=VaPQGiTq8Bc>`_
|
||||
De puzzel die ik heb gemaakt is afgeleid van de `oneshot color puzzle <https://www.youtube.com/watch?v=VaPQGiTq8Bc>`_ van de 2014 console game 'oneshot'. Bij deze puzzel moet de speler aan de hand
|
||||
van 5 knoppen de juiste kleur op eenp positie krijgen zonder te weten in welke volgorde deze moet.
|
||||
|
||||
.. image:: escape_room/design.png
|
||||
|
||||
Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, maar om kabels te besparen zullen we dit vervangen met leds van een
|
||||
WS2812B. Hiervoor is een simpele sketch gemaakt om vanaf te werken.
|
||||
|
||||
.. image:: escape_room/nwsketch.png
|
||||
|
||||
8 december: de puzzel is fysiek compleet maar moet nog geprogrammeerd worden en de bekabeling gecontroleerd, zodra dit gedeelte klaar is zijn er
|
||||
nog 2 mogelijke problemen met het gehele project: de puzzel naar puzzel communicatie en de intergratie van in de escapedoos.
|
||||
Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, om ruimte en praktische redenen werden de lampjes later vervangen met led-strips om bekabeling en troubleshooting
|
||||
een simpler process te maken. Dit liet ook toe dat de hele puzzel op een breakboard kon worden gesoldeerd voor een meer robust resultaat om goed in hout te kunnen worden gezet.
|
||||
|
||||
.. image:: escape_room/nanobuild.jpg
|
||||
.. image:: escape-room/oneshot_illustration.png
|
||||
|
||||
11 december: De puzzel is nog in productie maar het finale product is besloten, om het concept van de puzzel over te brengen heb ik ook een flowchart
|
||||
gemaakt om het process uit te leggen
|
||||
****
|
||||
code
|
||||
****
|
||||
|
||||
De code van dit prototype was geschreven in arduino/C++. Om de context van de code goed te begrijpen moet het spel ook begrepen worden: wanneer de puzzel opstart wordt er een willekeurige code
|
||||
gegenereerd van 5 cijfers tussen 1 en 5. Elk cijfer staat paralel met een kleur van led strips. Wanneer de gebruiker op de 6e knop drukt om de kleurcode te controleren krijgt deze feedback over
|
||||
hoeveel kleuren er correct zijn maar niet welke. De gebruiker kan dus alleen uitmaken welke kleur er correct is door af te leiden of er meer of minder correcte antwoorden zijn op basis van de feedback.
|
||||
Voor de gebruiker wordt de code dus een kwestie vane de kleuren blijven aanpassen op basis van welke score deze krijgt net zoals het raden van een cijfercombinatie van een slot.
|
||||
|
||||
De led-strips worden indvidueel aangestuurd door de knoppen. Elke keer dat de konp word ingedrukt wordt een waarde van de knop aangepast om overeen te komen met een kleur. Denk dus rood 1, groen 2 etc.
|
||||
.. image:: escape-room/oneshot_ledset.png
|
||||
|
||||
De waardes van de voorgenoemde led-strips worden hergebruikt voor het spel: De code die gegenereerd wordt heeft een vaste positie in een array. Als de gebruiker een lichtje veranderd via de knoppen dan wordt
|
||||
achter de schermen door de gebruiker een eigen code gebouwd met de waardes van de lichtjes. dus denk een combinatie van groen, geel, blauw en rood als 3, 4, 1 en 5. Wanneer de gebruiker de code controleerd word
|
||||
de array van de puzzel vergeleken met de array van de gebruiker. voor elk deel van de array's die niet overkomen word een fout waarde opgeteld, op basis van deze waarde krijgt de gebruiker te zien hoeveel er fout en goed waren.
|
||||
.. image:: escape-room/oneshot_arraycheck.png
|
||||
|
||||
.. image:: escape_room/oneshot_pwdgen.png
|
||||
|
||||
.. image:: escape_room/flowchart.png
|
||||
|
||||
27 januari: De puzzel is in hout gezet voor de presentatie, helaas was bij de decoratie de opbouw van de puzzel niet in consideratie genomen. Hierdoor is de originele
|
||||
decoratie niet gebruikt in het eindproduct. Dezelfde dag zijn de puzzels samen gezet in een doos en gepresenteerd met succes. Het project werd gecijferd over de hele groep maar
|
||||
ik kan met zekerheid zeggen dat mijn onderdeel van het project genoeg heeft toegevoegd om het finale resultaat acceptabel te maken. Op het moment dat ik mijn onderdeel
|
||||
finaliseerde besloot ik geen kansen te nemen en voegde ik instructies toe om feedback te verwerken in het project voor het geval het project erg schrijnend werd.
|
||||
|
||||
|
||||
Toen alles gezegd en gedaan was kwam er een groepscijfer uit van 6.1; normaal zou dit een middelmatig/onverschillig resultaat zijn maar sinds dit een herkansing,
|
||||
groepscijfer en het vak 4 studiepunten waard was nam ik het graag aan met gratie.
|
@ -9,29 +9,195 @@ learning to work with loops and statements. Through these projects we will be re
|
||||
The files refferenced can be found in https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source or the git repository.
|
||||
Apart from micropython no other packages have to be installed.
|
||||
|
||||
Notable files
|
||||
.. code-block:: python
|
||||
|
||||
Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not.
|
||||
from discolight_sl import *
|
||||
|
||||
.. collapse:: Notes
|
||||
# DiscoLed()
|
||||
police()
|
||||
# shutoff()
|
||||
# Riveting stuff i know
|
||||
|
||||
This code contains a lot of callable intergers, it also gives the function to the ledstrip to move from left to right.
|
||||
|
||||
|
||||
|
||||
What i did for this period code-wise is simply write a new function or script everytime i needed something, from there i'd just call said function in an adequetly named "main"
|
||||
file to test the function live. To this extent i only made a few files/functions to accomodate this class subject listed below:
|
||||
|
||||
- Main.py: As the name suggests this file's only purpose (as shown above) is to call upon a function from another file.
|
||||
- Colorwave: This file is used to define color to send to a ledstrip. This file is also equipped to test a led strip if the file is run as main.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from neopixel import Neopixel
|
||||
|
||||
numpix = 30
|
||||
strip = Neopixel(numpix, 0, 28, "GRB")
|
||||
# strip = Neopixel(numpsix, 0, 0, "GRBW")
|
||||
|
||||
red = (255, 0, 0)
|
||||
orange = (255, 50, 0)
|
||||
yellow = (255, 100, 0)
|
||||
green = (0, 255, 0)
|
||||
blue = (0, 0, 255)
|
||||
indigo = (100, 0, 90)
|
||||
violet = (200, 0, 100)
|
||||
colors_rgb = [red, orange, yellow, green, blue, indigo, violet]
|
||||
|
||||
while True:
|
||||
strip.rotate_right(1)
|
||||
time.sleep(0.15)
|
||||
strip.show()
|
||||
|
||||
Trivia
|
||||
|
||||
Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not. This code
|
||||
contains a lot of callable intergers to be used as a reference sheet to avoid clutter in the main code, it also gives the function to the ledstrip to move from left to right.
|
||||
|
||||
NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file with a full documentation on `github <https://github.com/adafruit/Adafruit_NeoPixel>`_.
|
||||
|
||||
.. collapse:: notes
|
||||
|
||||
This code contains all the technical functions of the ledstrip setup. The interesting part for the user are functinos such as "brightness", "show" and "rotate". Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the fun functions to create your own custom lighting.
|
||||
therefore it is a rather large file (text wise) with a full documentation on `github <https://github.com/adafruit/Adafruit_NeoPixel>`.
|
||||
This code contains all the technical functions of the ledstrip script. The interesting part for the user are functions such as **brightness**, **show** and **rotate**. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the *fun* functions to create your own custom lighting.
|
||||
|
||||
discolight_sl: This is the main file i'm currently using to stash all my functions in. For the moment this only includes some code i got from some `guy <https://git.herreweb.nl/EljakimHerrewijnen>`_
|
||||
called disco. My own code which is called police and a shutoff function. Because i'm too lazy to scroll for the functions i call them in a different file.
|
||||
|
||||
.. collapse:: Notes
|
||||
This code has very few interesting notes on how it functions: In the function: "discolight" we use a randomizer to set every pixel to some random rgb value. In the function:
|
||||
**police** we use a simpole calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take
|
||||
turns in who gets to light up first, creating a policelight effect.
|
||||
|
||||
This code has very few interesting notes, In the function: "discolight" we use a randomizer to set every pixel to some random rgb value. In the function :"police"
|
||||
we use a clever calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take turns
|
||||
in who gets to light up first, creating a policelight effect.
|
||||
The Exams
|
||||
|
||||
This code is a work in progress and will be continued in due time.
|
||||
I'll tell you straight up i failed the exams almost thrice due to a mixture of circumstance, lack of cricital knowledge, tunnel vision and as it's called in my own generation's
|
||||
words; *an issue of the skill* or *skill issue*. Since i generally find the fault with myself i tend to agree with the latter reason even if one exam was actually scuffed.
|
||||
|
||||
The exams revolved around being able to fetch data from a website, filter this data out to only show the data you want such as the latest uploaded temperature and wind direction.
|
||||
This data would be printed and the leds would be programmed to respond to the data with different collors (cold = 1-15 blue, hot 1-15 red stuff like that). The time given for this
|
||||
was about 3 days to figure out and turn into an essay with some proof. Now i knew my leds better than i knew everything else which was exactly the problem the first time,
|
||||
I could not figure out how to filter data and this caused me to crash with the grace of a piece of satelite space debris.
|
||||
|
||||
The second time i did an exam i was with one other guy. This time i actually had a decent idea of what i was supposed to do but there was a minor ever so slight inconvenience:
|
||||
The data you were supposed to collect was set up with a mqtt connection through a ssl connection. Now for context when i figured out this problem at the end of the 2nd day (roughly
|
||||
16-24 hours of work in). The ssl certificate system (in hindsight was a simple fix) was never mentioned or provided in the readers which caused me great annoyance. If it looks
|
||||
bad right now don't worry it gets worse. I mailed my teacher about it who neither knew nor cared about the issue at the time so i tried to just make things work by generating
|
||||
data myself and working out every solution i could.
|
||||
|
||||
Whilst doing all of this i learned a lot more about python and found out i'm very easily electrically charged. Yeah AD study's are something sometimes, just not a good something.
|
||||
|
||||
So i mentioned it would get worse and a random guy, now i made an essay with proof and an unhealthy dosis of "office passive aggression" to which I was asked and i quote: "How do
|
||||
you put so much malevolence and hatred in an essay?". Well i showed up hoping my extensive work would at least get me a pass on the subject, I was wrong: My teacher said that due
|
||||
asking the AI to generate data to test my code he couldn't trust my work even though i could not collect the data myself, to add insult to injury he blatanly ignored his connection
|
||||
mishap pulling the bureacratic move called "pleading oopsie daisy" and "It's a hbo study you should figure it out yourself bozo". To top it off the other guy had sent nothing
|
||||
in stating "if it didn't work he couldn't send it" and gave up early on. So to sum it up i spent 3 days debugging something unsolvable at the time and got another shot for my trouble,
|
||||
the other guy also got another shot for doing absolutely nothing. So the teacher would send another exam (3rd) later that week where he'd solve the connection part to ensure there was
|
||||
no faulty information or code on our side. Now i knew the other guy was notorious for using AI from which i restrain so my frustration was immense and understandable at this point. Since
|
||||
i got told to my face that my effort didn't matter in the slightest I opted to bureacraticly engage my teacher to a breaking point from that point on to ensure he would not pull any shenanigans
|
||||
like this again. (I continue this practice to this day.)
|
||||
|
||||
The third exam i did pass a week later and it felt hollow as a dead piece of bark. The code i wrote changed quite a lot since i copied from github and AI alike if i didn't understand something
|
||||
since at this point i didn't really give a hoot whether my code was or looked authentic since i got memed on by my teachers so I decided to return similar effort. This marks the beginning of
|
||||
the time where i stopped caring about how i got my code provided it worked first.
|
||||
|
||||
Much like how I started my code i divided everything up in functions but did throw at intergers into a singular file since at this point i did not care anymore. To quickly summarize everything;
|
||||
The code is given all functions to connect to the local wifi and to the mqtt broker afterwards. The last exam did not care for the ledstrip and just wanted to see a led output so it
|
||||
has a place alongside the print lines to show if the water was rising or falling. One of the tasks was to write the data of every hour or so to a csv file, for this I used the time of the
|
||||
watermeter against itself since it only updated every 10-15 minutes and made the pico write the data down every 5th time. I will say that the tricks employed in this code are interesting
|
||||
since it has a heavy focus on just being lazy but efficient which is a programmer's quota.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
import network
|
||||
from machine import Pin
|
||||
from simple import MQTTClient
|
||||
# import csv #i can't figure out why yet but csv disables the whole script
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
wlan.connect("ssid","ssidpwd")
|
||||
|
||||
ledup = Pin(16, Pin.OUT)
|
||||
leddown = Pin(17, Pin.OUT)
|
||||
|
||||
time.sleep(5)
|
||||
print(wlan.isconnected())
|
||||
|
||||
# Use the correct MQTT server address and topic
|
||||
mqtt_server = '825c912987534f048c3fbc28bb6ad943.s2.eu.hivemq.cloud'
|
||||
topic_sub = b'waterstand'
|
||||
|
||||
|
||||
def sub_cb(topic, msg):
|
||||
global preval, counter #create all variables used to avoid undefined errors
|
||||
topic_str = topic.decode("utf-8") # remove unwanted characters using the strip() method https://www.w3schools.com/python/ref_string_strip.asp
|
||||
# remove unwanted characters using the strip() method
|
||||
msg_str = msg.decode("utf-8").strip()
|
||||
print("New message on topic {}".format(topic_str))
|
||||
# value = msg_str[-4:].replace(';', '') # this is the first method i used to ensure if the leds function worked, this however had problems with slicing giving me characters back which crashed the program
|
||||
print(f"Received Data: Topic = {topic_str}, Msg = {msg_str}")
|
||||
# get the last item of the resulting list sorted by ;
|
||||
value = msg_str.split(";")[-1]
|
||||
print("Value: ", value)
|
||||
newval = int(value)
|
||||
if newval != preval: # compare new value with previous value
|
||||
if newval > preval:
|
||||
ledup.on()
|
||||
leddown.off()
|
||||
print("value going up")
|
||||
elif newval < preval:
|
||||
leddown.on()
|
||||
ledup.off()
|
||||
print("value going down")
|
||||
preval = newval # update previous value
|
||||
|
||||
counter += 1
|
||||
if counter == 4:
|
||||
csvfile2 = open("data.csv", "a") #turns out write overwrites the entire file and i'm just a moron
|
||||
# to ensure this works i'm using the stripped string version so no b or /n but ; stays
|
||||
csvfile2.write(str(msg_str).replace(';', ',') + ",")
|
||||
print('Data written to CSV file')
|
||||
# Reset counter
|
||||
counter = 0
|
||||
# data = [] #initially i thought i needed a list and to call or clear the last function every time
|
||||
# # # hoe kom je van de b" en de \n af? zoek dat op.
|
||||
|
||||
def connectMQTT():
|
||||
client = MQTTClient(client_id=b'1061348',
|
||||
server=mqtt_server,
|
||||
port=8883,
|
||||
user=b"racdata",
|
||||
password=b"herkansingpython2",
|
||||
keepalive=7200,
|
||||
ssl=True,
|
||||
ssl_params={'server_hostname': mqtt_server}
|
||||
)
|
||||
client.set_callback(sub_cb)
|
||||
client.connect()
|
||||
print('Connected to %s MQTT Broker' % (mqtt_server))
|
||||
return client
|
||||
|
||||
# If failed to connect to the MQTT broker, reset the machine
|
||||
|
||||
|
||||
def reconnect():
|
||||
print('Failed to connect to MQTT Broker. Reconnecting...')
|
||||
time.sleep(5)
|
||||
machine.reset()
|
||||
|
||||
|
||||
# Try to connect to the MQTT broker, if failed, reconnect
|
||||
try:
|
||||
client = connectMQTT()
|
||||
except OSError as e:
|
||||
reconnect()
|
||||
|
||||
preval = 0 # old first value
|
||||
counter = 0 # Initialize the counter
|
||||
while True:
|
||||
# ledup.on()
|
||||
time.sleep(5)
|
||||
# ledup.off()
|
||||
client.subscribe(topic_sub) # subscribe to the topic
|
||||
time.sleep(1)
|
||||
|
||||
What you can take away from all this is that much like the modern workplace hard work does not actually pay, efficient, lazy, idiotproof and preresearched work pays. It's not
|
||||
about how hard you try or how committed you are it's about if it works and how good it works. The strongest sword wains when the wielder is weak so be smart and disciplined.
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -85,10 +86,10 @@
|
||||
<p>Tabel van opdrachten</p>
|
||||
<table class="docutils align-default">
|
||||
<colgroup>
|
||||
<col style="width: 24%" />
|
||||
<col style="width: 28%" />
|
||||
<col style="width: 42%" />
|
||||
<col style="width: 7%" />
|
||||
<col style="width: 33%" />
|
||||
<col style="width: 20%" />
|
||||
<col style="width: 32%" />
|
||||
<col style="width: 15%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="row-odd"><th class="head"><p>Wat</p></th>
|
||||
@ -119,40 +120,25 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>HerExamen 2 SQLite</p></td>
|
||||
<td></td>
|
||||
<td><p>lees dit keer iets meer door</p></td>
|
||||
<td></td>
|
||||
<tr class="row-odd"><td><p>Krane impact</p></td>
|
||||
<td><p>01/07/2024</p></td>
|
||||
<td><p>Fall Ost</p></td>
|
||||
<td><p>Ongoing</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Nederlands her-Examen 3</p></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<tr class="row-even"><td><p>internship essay</p></td>
|
||||
<td><p>september</p></td>
|
||||
<td><p>initial defeat</p></td>
|
||||
<td><p>Ongoing</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Stage + opdracht</p></td>
|
||||
<td><p>januari</p></td>
|
||||
<td><p>moet voor periode 3 januri geregeld zijn</p></td>
|
||||
<td></td>
|
||||
<tr class="row-odd"><td><p>Workplace Research</p></td>
|
||||
<td><p>???</p></td>
|
||||
<td><p>Last man standing</p></td>
|
||||
<td><p>tbd</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Afstudeerstage + opdracht</p></td>
|
||||
<td><p>20 januari</p></td>
|
||||
<td><p>vereist voor het cijfer van SQLite</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Keuzevak voor jaar 2</p></td>
|
||||
<td><p>2023-2024</p></td>
|
||||
<td><p>opmaak voor gefaald zorgrobot, japans misschien?</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Haal firebeetle op van paul</p></td>
|
||||
<td><p>4 september 2023 - 28 juli 2024</p></td>
|
||||
<td><p>uitleensel</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Fnaf movie october</p></td>
|
||||
<td><p>27 october</p></td>
|
||||
<td><p>Groep/solo uitje</p></td>
|
||||
<td></td>
|
||||
<tr class="row-even"><td><p>Zenoh casus</p></td>
|
||||
<td><p>???</p></td>
|
||||
<td><p>initiative</p></td>
|
||||
<td><p>tbd</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -170,6 +171,56 @@
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Data</p></td>
|
||||
<td><p>9.0</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>RSP</p></td>
|
||||
<td><p>8.5</p></td>
|
||||
<td><p>4 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>UX</p></td>
|
||||
<td><p>5.5</p></td>
|
||||
<td><p>4 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Ethiek</p></td>
|
||||
<td><p>8.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Cisco Intergraal</p></td>
|
||||
<td><p>8.8</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Data</p></td>
|
||||
<td><p>9.0</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Design research</p></td>
|
||||
<td><p>8.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>slc final assesment</p></td>
|
||||
<td><p>7.0</p></td>
|
||||
<td><p>5 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>State of the art 1</p></td>
|
||||
<td><p>9.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>State of the art 2</p></td>
|
||||
<td><p>9.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
@ -177,10 +228,10 @@
|
||||
<h1>herkansingen<a class="headerlink" href="#herkansingen" title="Permalink to this heading"></a></h1>
|
||||
<table class="docutils align-default">
|
||||
<colgroup>
|
||||
<col style="width: 28%" />
|
||||
<col style="width: 13%" />
|
||||
<col style="width: 16%" />
|
||||
<col style="width: 42%" />
|
||||
<col style="width: 21%" />
|
||||
<col style="width: 10%" />
|
||||
<col style="width: 20%" />
|
||||
<col style="width: 49%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="row-odd"><td><p>Vak</p></td>
|
||||
@ -188,29 +239,24 @@
|
||||
<td><p>studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>User Experience</p></td>
|
||||
<td><p>5.2</p></td>
|
||||
<td><p>4 studiepunten</p></td>
|
||||
<tr class="row-even"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>SQLite</p></td>
|
||||
<td><p>4.2</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<tr class="row-odd"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>zorgrobot</p></td>
|
||||
<td><p>5.0</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td><p>Keuzevak (niet voor herhaling vatbaar)</p></td>
|
||||
<tr class="row-even"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>OP2 studieloopbaancoaching</p></td>
|
||||
<td><p>Onvoldoende</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td><p>Forgor thrice, couldn’t redo b4 new year</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Nederlands</p></td>
|
||||
<td><p>5.3</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<tr class="row-odd"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -83,27 +84,33 @@
|
||||
<section id="escape-room-ithamar">
|
||||
<h1>escape-room ithamar<a class="headerlink" href="#escape-room-ithamar" title="Permalink to this heading"></a></h1>
|
||||
<p>Documentatie voor ithamar’s escaperoom.</p>
|
||||
<p>Voor jaar 1 periode 2 van mijn studie IoT moet ik een escaperoom maken met een arduino in een groepje. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de werkplaats arduino.</p>
|
||||
<p>Het groepje waarbij ik zit heeft als thema: horror, ondanks dit thema is de echte horror een doos vinden om de escaperoom uit te maken
|
||||
en op tijd de puzzles te maken en te kunnen verwerken in deze doos.</p>
|
||||
<p>De puzzel die ik wil maken is afgeleid van de <a class="reference external" href="https://www.youtube.com/watch?v=VaPQGiTq8Bc">oneshot color puzzle</a></p>
|
||||
<p>Voor jaar 1 periode 2 van de studie Internet of Things moeten de studenten in een groepje een escaperoom maken met arduino’s. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de periode bij het vak ‘werkplaats arduino’ om creativiteit en affiniteit te demonstreren binnen het vak.</p>
|
||||
<p>Het groepje waarbij ik zat heeft als thema: horror, het denkproces achter dit thema is om een authentieke escaperoom te imiteren door de puzzels op een logische manier op elkaar te laten
|
||||
aansluiten. Het concept achter de escaperoom was om een doos te bouwen uit plywood en de 4 horizontale zijdes te gebruiken om de puzzels in te bouwen en zo klokwijs op elkaar aan te sluiten.</p>
|
||||
<p>De puzzel die ik heb gemaakt is afgeleid van de <a class="reference external" href="https://www.youtube.com/watch?v=VaPQGiTq8Bc">oneshot color puzzle</a> van de 2014 console game ‘oneshot’. Bij deze puzzel moet de speler aan de hand
|
||||
van 5 knoppen de juiste kleur op eenp positie krijgen zonder te weten in welke volgorde deze moet.</p>
|
||||
<img alt="_images/design.png" src="_images/design.png" />
|
||||
<p>Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, maar om kabels te besparen zullen we dit vervangen met leds van een
|
||||
WS2812B. Hiervoor is een simpele sketch gemaakt om vanaf te werken.</p>
|
||||
<img alt="_images/nwsketch.png" src="_images/nwsketch.png" />
|
||||
<p>8 december: de puzzel is fysiek compleet maar moet nog geprogrammeerd worden en de bekabeling gecontroleerd, zodra dit gedeelte klaar is zijn er
|
||||
nog 2 mogelijke problemen met het gehele project: de puzzel naar puzzel communicatie en de intergratie van in de escapedoos.</p>
|
||||
<p>Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, om ruimte en praktische redenen werden de lampjes later vervangen met led-strips om bekabeling en troubleshooting
|
||||
een simpler process te maken. Dit liet ook toe dat de hele puzzel op een breakboard kon worden gesoldeerd voor een meer robust resultaat om goed in hout te kunnen worden gezet.</p>
|
||||
<img alt="_images/nanobuild.jpg" src="_images/nanobuild.jpg" />
|
||||
<p>11 december: De puzzel is nog in productie maar het finale product is besloten, om het concept van de puzzel over te brengen heb ik ook een flowchart
|
||||
gemaakt om het process uit te leggen</p>
|
||||
<img alt="escape-room/oneshot_illustration.png" src="escape-room/oneshot_illustration.png" />
|
||||
</section>
|
||||
<section id="code">
|
||||
<h1>code<a class="headerlink" href="#code" title="Permalink to this heading"></a></h1>
|
||||
<p>De code van dit prototype was geschreven in arduino/C++. Om de context van de code goed te begrijpen moet het spel ook begrepen worden: wanneer de puzzel opstart wordt er een willekeurige code
|
||||
gegenereerd van 5 cijfers tussen 1 en 5. Elk cijfer staat paralel met een kleur van led strips. Wanneer de gebruiker op de 6e knop drukt om de kleurcode te controleren krijgt deze feedback over
|
||||
hoeveel kleuren er correct zijn maar niet welke. De gebruiker kan dus alleen uitmaken welke kleur er correct is door af te leiden of er meer of minder correcte antwoorden zijn op basis van de feedback.
|
||||
Voor de gebruiker wordt de code dus een kwestie vane de kleuren blijven aanpassen op basis van welke score deze krijgt net zoals het raden van een cijfercombinatie van een slot.</p>
|
||||
<p>De led-strips worden indvidueel aangestuurd door de knoppen. Elke keer dat de konp word ingedrukt wordt een waarde van de knop aangepast om overeen te komen met een kleur. Denk dus rood 1, groen 2 etc.
|
||||
.. image:: escape-room/oneshot_ledset.png</p>
|
||||
<p>De waardes van de voorgenoemde led-strips worden hergebruikt voor het spel: De code die gegenereerd wordt heeft een vaste positie in een array. Als de gebruiker een lichtje veranderd via de knoppen dan wordt
|
||||
achter de schermen door de gebruiker een eigen code gebouwd met de waardes van de lichtjes. dus denk een combinatie van groen, geel, blauw en rood als 3, 4, 1 en 5. Wanneer de gebruiker de code controleerd word
|
||||
de array van de puzzel vergeleken met de array van de gebruiker. voor elk deel van de array’s die niet overkomen word een fout waarde opgeteld, op basis van deze waarde krijgt de gebruiker te zien hoeveel er fout en goed waren.
|
||||
.. image:: escape-room/oneshot_arraycheck.png</p>
|
||||
<img alt="_images/oneshot_pwdgen.png" src="_images/oneshot_pwdgen.png" />
|
||||
<img alt="_images/flowchart.png" src="_images/flowchart.png" />
|
||||
<p>27 januari: De puzzel is in hout gezet voor de presentatie, helaas was bij de decoratie de opbouw van de puzzel niet in consideratie genomen. Hierdoor is de originele
|
||||
decoratie niet gebruikt in het eindproduct. Dezelfde dag zijn de puzzels samen gezet in een doos en gepresenteerd met succes. Het project werd gecijferd over de hele groep maar
|
||||
ik kan met zekerheid zeggen dat mijn onderdeel van het project genoeg heeft toegevoegd om het finale resultaat acceptabel te maken. Op het moment dat ik mijn onderdeel
|
||||
finaliseerde besloot ik geen kansen te nemen en voegde ik instructies toe om feedback te verwerken in het project voor het geval het project erg schrijnend werd.</p>
|
||||
<p>Toen alles gezegd en gedaan was kwam er een groepscijfer uit van 6.1; normaal zou dit een middelmatig/onverschillig resultaat zijn maar sinds dit een herkansing,
|
||||
groepscijfer en het vak 4 studiepunten waard was nam ik het graag aan met gratie.</p>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
|
@ -104,7 +104,7 @@ op een idee te presenteren gebaseerd op huidig beschikbare informatie en vroegti
|
||||
<p>Voor de metingen nam ik de moeite de meet locatie te verkennen en uit te beelden op een schema voor een uiteindelijk verslag. Hiermee konden de partijen ook de locatie van hun
|
||||
meetappartuur vroegtijdig aangeven. Verder zocht ik (tervegeefs) contact met de aandeelhouders maar dit werdt later door een leraar verholpen sinds alle groepjes hier problemen
|
||||
mee hadden.</p>
|
||||
<img alt="werkplaats_realiseren/diagramperiod3.png" src="werkplaats_realiseren/diagramperiod3.png" />
|
||||
<img alt="_images/diagramperiod3.png" src="_images/diagramperiod3.png" />
|
||||
<p>Voor deze periode had ik een prototype bedacht dat om de gebruikers te meten aan de hand van bluetooth signalen in een 5-10 meter radius dat gebruik maakte van het slechte
|
||||
signaal in de toiletten en wat positionering. Voor dit prototype dacht ik eerst de hc-05 bluetooth module voor te gebruiken maar ik had voor de veiligheid 2 esp32 firebeetle
|
||||
bordjes gekocht die niet afhankelijk waren van een externe sensor om bluetooth signalen op te pikken. Onthoud dat op dit punt was het meer een paper prototype dan een solide
|
||||
|
@ -38,14 +38,20 @@
|
||||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<p class="caption" role="heading"><span class="caption-text">Overview:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="agenda.html">Ithamar’s Agenda</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html">Cijferlijst</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html#herkansingen">herkansingen</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2023-2024:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Stage/Internship</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#meewerkstage">meewerkstage</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#afstudeerstage">Afstudeerstage</a></li>
|
||||
@ -79,25 +85,18 @@
|
||||
|
||||
<section id="stage-internship">
|
||||
<h1>Stage/Internship<a class="headerlink" href="#stage-internship" title="Permalink to this heading"></a></h1>
|
||||
<p>Voor Jaar 2 Periode 2 moeten de studenten een stage vinden en lopen. De eerste stage is een meewerkstage waar de student moet leren in een werkomgeving te presteren en een idee
|
||||
te krijgen over hun werk in de praktijk. De “tweede” stage is een afstudeerstage die vanaf periode 3 tot 4 duurt waarbij de student een afstudeeropdracht moet maken bij het
|
||||
bedrijf waar ze stage lopen. De stages mogen en kunnen bij een bedrijf worden uitgevoerd maar de student wordt verwacht zelf contact te leggen met een bedrijf en een stage te
|
||||
regelen.</p>
|
||||
<p>Voor Jaar 2 Periode 2 moeten de studenten een stage vinden. Dit traject is verdeeld in twee stages waar de student wordt getoetst op alles wat hij/zij heeft geleerd in de studie
|
||||
en moet uiteindelijk op basis van deze stage slagen voor de opleiding. De stage is officieel verdeeld in twee stages maar kan op een adres worden gelopen mits het bedrijf de
|
||||
student kan begeleiden op basis van de studie.</p>
|
||||
<section id="meewerkstage">
|
||||
<h2>meewerkstage<a class="headerlink" href="#meewerkstage" title="Permalink to this heading"></a></h2>
|
||||
<p>De meewerkstage is de warmup van hoe het jaar er uit gaat zien voor de studenten en zoals met de meeste opdrachten die de studenten hebben gedaan in het vorige jaar is dit het
|
||||
“makkelijke” deel voordat net zoals met andere vakken de volgende opdracht een veel uitdagendere variant is van dezelfde opdracht. Een simpel voorbeeld hiervan is jaar 2 periode 1:
|
||||
In deze periode moet de student laten zien dat hij een stage kan bemachtigen, enkel dit voor een vak. Nu voor periode 2 moet de student bij deze stageplek meelopen op de werkvloer.
|
||||
Periode 3-4 zijn gelijk geclusterd en vragen (als de student geen geschikte stageplek heeft gekozen) het process van periode 1 en 2 opnieuw uit te voeren en daarbij ook op eigen
|
||||
initiatief een afstudeeropdracht te bedenken, uit te voeren door meerdere vakken te herhalen zoals de werkplaats en User Experience in een kwestie van 2 periodes met een tijdslimiet.</p>
|
||||
<p>De eerste stage: dit wordt toegevoegd zodra ik een stage heb</p>
|
||||
<p>De meewerkstage is bedoeld om studenten ervaring te laten op doen op de werkvloer als een echte baan. Deze stage duurt voor de gehele duratie van waar de student stage loopt
|
||||
en tijdens deze stage wordt er verwacht dat de student meedraait als een reguliere werknemer in het bedrijf. Wat wel van belang is tijdens deze stage is het zoeken naar een
|
||||
afstudeercasus om de afstudeerstage te kunnen starten in de 3e periode van het studiejaar.</p>
|
||||
</section>
|
||||
<section id="afstudeerstage">
|
||||
<h2>Afstudeerstage<a class="headerlink" href="#afstudeerstage" title="Permalink to this heading"></a></h2>
|
||||
<p>De afstudeerstage is zoals voorheen benoemd 3-4 vakken in een blender gedeponeerd, gemixt met aceton en geinjecteerd met steroids: De student moet als hij geen gepaste stage had
|
||||
in periode 2 een nieuwe stage vinden en in het bedrijf meedraaien terwijl de student ook een afstudeeropdracht moet bedenken waarbij de student een verbetering/contributie voor
|
||||
het bedrijf moet bedenken, ontwerpen en bouwen tot een prototype. Dit is ook praktisch de finale opdracht van de studie waar de student alles wat ze hebben geleerd moeten
|
||||
gebruiken om te laten zien das ze HBO en IoT materiaal zijn.</p>
|
||||
<p>Voor de afstudeerstage moet de student een casus vinden binnen het bedrijf dat de student mogelijk kan oplossen met IoT.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
BIN
documentation/build/html/_images/diagramperiod3.png
Normal file
After Width: | Height: | Size: 45 KiB |
@ -1,74 +0,0 @@
|
||||
<mxfile host="65bd71144e">
|
||||
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
|
||||
<mxGraphModel dx="1204" dy="788" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0"/>
|
||||
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0"/>
|
||||
<mxCell id="WIyWlLk6GJQsqaUBKTNV-2" value="" style="rounded=0;html=1;jettySize=auto;orthogonalLoop=1;fontSize=11;endArrow=block;endFill=0;endSize=8;strokeWidth=1;shadow=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-3" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="170" as="targetPoint"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="WIyWlLk6GJQsqaUBKTNV-3" value="Nano is inactive" style="rounded=1;whiteSpace=wrap;html=1;fontSize=12;glass=0;strokeWidth=1;shadow=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="160" y="80" width="120" height="40" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-0" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="270" as="targetPoint"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-0" value="User presses led button" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="160" y="150" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-3" target="cu5jRHnhM64dbvBLo5j4-4" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-3" value="button status changes<br>counter changes to <br>next value" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="160" y="240" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-4" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="220" y="450" as="targetPoint"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-4" value="led changes color<br>based on counter value" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="160" y="320" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-8" target="cu5jRHnhM64dbvBLo5j4-9" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-8" value="<div>User presses check <br></div><div>button<br></div>" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="160" y="400" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-16" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-9" target="cu5jRHnhM64dbvBLo5j4-15" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-20" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-9" target="cu5jRHnhM64dbvBLo5j4-19" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-9" value="<div>Are the colors</div><div>Correct?</div>" style="rhombus;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="170" y="470" width="100" height="100" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cu5jRHnhM64dbvBLo5j4-15" target="cu5jRHnhM64dbvBLo5j4-0" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="410" y="180"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-15" value="<div>Display correct <br></div><div>amount of leds<br></div>" style="whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="340" y="490" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-18" value="NO" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="270" y="490" width="60" height="30" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-19" value="Congrats, play jingle" style="rounded=1;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry y="490" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="cu5jRHnhM64dbvBLo5j4-21" value="yes" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||
<mxGeometry x="120" y="490" width="60" height="30" as="geometry"/>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
BIN
documentation/build/html/_images/oneshot_pwdgen.png
Normal file
After Width: | Height: | Size: 28 KiB |
@ -21,7 +21,7 @@ Voor de metingen nam ik de moeite de meet locatie te verkennen en uit te beelden
|
||||
meetappartuur vroegtijdig aangeven. Verder zocht ik (tervegeefs) contact met de aandeelhouders maar dit werdt later door een leraar verholpen sinds alle groepjes hier problemen
|
||||
mee hadden.
|
||||
|
||||
.. image:: werkplaats_realiseren/diagram period 3.png
|
||||
.. image:: werkplaats_realiseren/diagramperiod3.png
|
||||
|
||||
Voor deze periode had ik een prototype bedacht dat om de gebruikers te meten aan de hand van bluetooth signalen in een 5-10 meter radius dat gebruik maakte van het slechte
|
||||
signaal in de toiletten en wat positionering. Voor dit prototype dacht ik eerst de hc-05 bluetooth module voor te gebruiken maar ik had voor de veiligheid 2 esp32 firebeetle
|
||||
|
@ -2,26 +2,18 @@
|
||||
Stage/Internship
|
||||
****************
|
||||
|
||||
Voor Jaar 2 Periode 2 moeten de studenten een stage vinden en lopen. De eerste stage is een meewerkstage waar de student moet leren in een werkomgeving te presteren en een idee
|
||||
te krijgen over hun werk in de praktijk. De "tweede" stage is een afstudeerstage die vanaf periode 3 tot 4 duurt waarbij de student een afstudeeropdracht moet maken bij het
|
||||
bedrijf waar ze stage lopen. De stages mogen en kunnen bij een bedrijf worden uitgevoerd maar de student wordt verwacht zelf contact te leggen met een bedrijf en een stage te
|
||||
regelen.
|
||||
Voor Jaar 2 Periode 2 moeten de studenten een stage vinden. Dit traject is verdeeld in twee stages waar de student wordt getoetst op alles wat hij/zij heeft geleerd in de studie
|
||||
en moet uiteindelijk op basis van deze stage slagen voor de opleiding. De stage is officieel verdeeld in twee stages maar kan op een adres worden gelopen mits het bedrijf de
|
||||
student kan begeleiden op basis van de studie.
|
||||
|
||||
meewerkstage
|
||||
------------
|
||||
|
||||
De meewerkstage is de warmup van hoe het jaar er uit gaat zien voor de studenten en zoals met de meeste opdrachten die de studenten hebben gedaan in het vorige jaar is dit het
|
||||
"makkelijke" deel voordat net zoals met andere vakken de volgende opdracht een veel uitdagendere variant is van dezelfde opdracht. Een simpel voorbeeld hiervan is jaar 2 periode 1:
|
||||
In deze periode moet de student laten zien dat hij een stage kan bemachtigen, enkel dit voor een vak. Nu voor periode 2 moet de student bij deze stageplek meelopen op de werkvloer.
|
||||
Periode 3-4 zijn gelijk geclusterd en vragen (als de student geen geschikte stageplek heeft gekozen) het process van periode 1 en 2 opnieuw uit te voeren en daarbij ook op eigen
|
||||
initiatief een afstudeeropdracht te bedenken, uit te voeren door meerdere vakken te herhalen zoals de werkplaats en User Experience in een kwestie van 2 periodes met een tijdslimiet.
|
||||
|
||||
De eerste stage: dit wordt toegevoegd zodra ik een stage heb
|
||||
De meewerkstage is bedoeld om studenten ervaring te laten op doen op de werkvloer als een echte baan. Deze stage duurt voor de gehele duratie van waar de student stage loopt
|
||||
en tijdens deze stage wordt er verwacht dat de student meedraait als een reguliere werknemer in het bedrijf. Wat wel van belang is tijdens deze stage is het zoeken naar een
|
||||
afstudeercasus om de afstudeerstage te kunnen starten in de 3e periode van het studiejaar.
|
||||
|
||||
Afstudeerstage
|
||||
--------------
|
||||
|
||||
De afstudeerstage is zoals voorheen benoemd 3-4 vakken in een blender gedeponeerd, gemixt met aceton en geinjecteerd met steroids: De student moet als hij geen gepaste stage had
|
||||
in periode 2 een nieuwe stage vinden en in het bedrijf meedraaien terwijl de student ook een afstudeeropdracht moet bedenken waarbij de student een verbetering/contributie voor
|
||||
het bedrijf moet bedenken, ontwerpen en bouwen tot een prototype. Dit is ook praktisch de finale opdracht van de studie waar de student alles wat ze hebben geleerd moeten
|
||||
gebruiken om te laten zien das ze HBO en IoT materiaal zijn.
|
||||
Voor de afstudeerstage moet de student een casus vinden binnen het bedrijf dat de student mogelijk kan oplossen met IoT.
|
@ -4,23 +4,17 @@ Ithamar's Agenda
|
||||
Tabel van opdrachten
|
||||
|
||||
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Wat | Wanneer | Opmerking | Status |
|
||||
+=============================+=================================+==================================================+========+
|
||||
|| || || || |
|
||||
|| || || || |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| HerExamen 2 SQLite | ????? | lees dit keer iets meer door | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Nederlands her-Examen 3 | ???? | | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Stage + opdracht | januari | moet voor periode 3 januri geregeld zijn | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Afstudeerstage + opdracht | 20 januari | vereist voor het cijfer van SQLite | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Keuzevak voor jaar 2 | 2023-2024 | opmaak voor gefaald zorgrobot, japans misschien? | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Haal firebeetle op van paul | 4 september 2023 - 28 juli 2024 | uitleensel | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Fnaf movie october | 27 october | Groep/solo uitje | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Wat | Wanneer | Opmerking | Status |
|
||||
+====================+============+===================+=========+
|
||||
|| || || || |
|
||||
|| || || || |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Krane impact | 01/07/2024 | Fall Ost | Ongoing |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| internship essay | september | initial defeat | Ongoing |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Workplace Research | ??? | Last man standing | tbd |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Zenoh casus | ??? | initiative | tbd |
|
||||
+--------------------+------------+-------------------+---------+
|
@ -35,21 +35,36 @@ Cijferlijst
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| studieloopbaancoaching 1 | Voldoende | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Data | 9.0 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| RSP | 8.5 | 4 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| UX | 5.5 | 4 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Ethiek | 8.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Cisco Intergraal | 8.8 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Data | 9.0 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Design research | 8.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| slc final assesment | 7.0 | 5 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| State of the art 1 | 9.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| State of the art 2 | 9.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
|
||||
************
|
||||
herkansingen
|
||||
************
|
||||
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| Vak | Cijfer | studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| User Experience | 5.2 | 4 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| SQLite | 4.2 | 2 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| zorgrobot | 5.0 | 2 studiepunten | Keuzevak (niet voor herhaling vatbaar) |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| OP2 studieloopbaancoaching | Onvoldoende | 2 studiepunten | Forgor thrice, couldn't redo b4 new year |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| Nederlands | 5.3 | 2 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
| Vak | Cijfer | studiepunten | |
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
| | | | |
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
@ -3,36 +3,43 @@ escape-room ithamar
|
||||
*******************
|
||||
Documentatie voor ithamar's escaperoom.
|
||||
|
||||
Voor jaar 1 periode 2 van mijn studie IoT moet ik een escaperoom maken met een arduino in een groepje. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de werkplaats arduino.
|
||||
Voor jaar 1 periode 2 van de studie Internet of Things moeten de studenten in een groepje een escaperoom maken met arduino's. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de periode bij het vak 'werkplaats arduino' om creativiteit en affiniteit te demonstreren binnen het vak.
|
||||
|
||||
Het groepje waarbij ik zit heeft als thema: horror, ondanks dit thema is de echte horror een doos vinden om de escaperoom uit te maken
|
||||
en op tijd de puzzles te maken en te kunnen verwerken in deze doos.
|
||||
Het groepje waarbij ik zat heeft als thema: horror, het denkproces achter dit thema is om een authentieke escaperoom te imiteren door de puzzels op een logische manier op elkaar te laten
|
||||
aansluiten. Het concept achter de escaperoom was om een doos te bouwen uit plywood en de 4 horizontale zijdes te gebruiken om de puzzels in te bouwen en zo klokwijs op elkaar aan te sluiten.
|
||||
|
||||
De puzzel die ik wil maken is afgeleid van de `oneshot color puzzle <https://www.youtube.com/watch?v=VaPQGiTq8Bc>`_
|
||||
De puzzel die ik heb gemaakt is afgeleid van de `oneshot color puzzle <https://www.youtube.com/watch?v=VaPQGiTq8Bc>`_ van de 2014 console game 'oneshot'. Bij deze puzzel moet de speler aan de hand
|
||||
van 5 knoppen de juiste kleur op eenp positie krijgen zonder te weten in welke volgorde deze moet.
|
||||
|
||||
.. image:: escape_room/design.png
|
||||
|
||||
Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, maar om kabels te besparen zullen we dit vervangen met leds van een
|
||||
WS2812B. Hiervoor is een simpele sketch gemaakt om vanaf te werken.
|
||||
|
||||
.. image:: escape_room/nwsketch.png
|
||||
|
||||
8 december: de puzzel is fysiek compleet maar moet nog geprogrammeerd worden en de bekabeling gecontroleerd, zodra dit gedeelte klaar is zijn er
|
||||
nog 2 mogelijke problemen met het gehele project: de puzzel naar puzzel communicatie en de intergratie van in de escapedoos.
|
||||
Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, om ruimte en praktische redenen werden de lampjes later vervangen met led-strips om bekabeling en troubleshooting
|
||||
een simpler process te maken. Dit liet ook toe dat de hele puzzel op een breakboard kon worden gesoldeerd voor een meer robust resultaat om goed in hout te kunnen worden gezet.
|
||||
|
||||
.. image:: escape_room/nanobuild.jpg
|
||||
.. image:: escape-room/oneshot_illustration.png
|
||||
|
||||
11 december: De puzzel is nog in productie maar het finale product is besloten, om het concept van de puzzel over te brengen heb ik ook een flowchart
|
||||
gemaakt om het process uit te leggen
|
||||
****
|
||||
code
|
||||
****
|
||||
|
||||
De code van dit prototype was geschreven in arduino/C++. Om de context van de code goed te begrijpen moet het spel ook begrepen worden: wanneer de puzzel opstart wordt er een willekeurige code
|
||||
gegenereerd van 5 cijfers tussen 1 en 5. Elk cijfer staat paralel met een kleur van led strips. Wanneer de gebruiker op de 6e knop drukt om de kleurcode te controleren krijgt deze feedback over
|
||||
hoeveel kleuren er correct zijn maar niet welke. De gebruiker kan dus alleen uitmaken welke kleur er correct is door af te leiden of er meer of minder correcte antwoorden zijn op basis van de feedback.
|
||||
Voor de gebruiker wordt de code dus een kwestie vane de kleuren blijven aanpassen op basis van welke score deze krijgt net zoals het raden van een cijfercombinatie van een slot.
|
||||
|
||||
De led-strips worden indvidueel aangestuurd door de knoppen. Elke keer dat de konp word ingedrukt wordt een waarde van de knop aangepast om overeen te komen met een kleur. Denk dus rood 1, groen 2 etc.
|
||||
.. image:: escape-room/oneshot_ledset.png
|
||||
|
||||
De waardes van de voorgenoemde led-strips worden hergebruikt voor het spel: De code die gegenereerd wordt heeft een vaste positie in een array. Als de gebruiker een lichtje veranderd via de knoppen dan wordt
|
||||
achter de schermen door de gebruiker een eigen code gebouwd met de waardes van de lichtjes. dus denk een combinatie van groen, geel, blauw en rood als 3, 4, 1 en 5. Wanneer de gebruiker de code controleerd word
|
||||
de array van de puzzel vergeleken met de array van de gebruiker. voor elk deel van de array's die niet overkomen word een fout waarde opgeteld, op basis van deze waarde krijgt de gebruiker te zien hoeveel er fout en goed waren.
|
||||
.. image:: escape-room/oneshot_arraycheck.png
|
||||
|
||||
.. image:: escape_room/oneshot_pwdgen.png
|
||||
|
||||
.. image:: escape_room/flowchart.png
|
||||
|
||||
27 januari: De puzzel is in hout gezet voor de presentatie, helaas was bij de decoratie de opbouw van de puzzel niet in consideratie genomen. Hierdoor is de originele
|
||||
decoratie niet gebruikt in het eindproduct. Dezelfde dag zijn de puzzels samen gezet in een doos en gepresenteerd met succes. Het project werd gecijferd over de hele groep maar
|
||||
ik kan met zekerheid zeggen dat mijn onderdeel van het project genoeg heeft toegevoegd om het finale resultaat acceptabel te maken. Op het moment dat ik mijn onderdeel
|
||||
finaliseerde besloot ik geen kansen te nemen en voegde ik instructies toe om feedback te verwerken in het project voor het geval het project erg schrijnend werd.
|
||||
|
||||
|
||||
Toen alles gezegd en gedaan was kwam er een groepscijfer uit van 6.1; normaal zou dit een middelmatig/onverschillig resultaat zijn maar sinds dit een herkansing,
|
||||
groepscijfer en het vak 4 studiepunten waard was nam ik het graag aan met gratie.
|
@ -9,29 +9,195 @@ learning to work with loops and statements. Through these projects we will be re
|
||||
The files refferenced can be found in https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source or the git repository.
|
||||
Apart from micropython no other packages have to be installed.
|
||||
|
||||
Notable files
|
||||
.. code-block:: python
|
||||
|
||||
Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not.
|
||||
from discolight_sl import *
|
||||
|
||||
.. collapse:: Notes
|
||||
# DiscoLed()
|
||||
police()
|
||||
# shutoff()
|
||||
# Riveting stuff i know
|
||||
|
||||
This code contains a lot of callable intergers, it also gives the function to the ledstrip to move from left to right.
|
||||
|
||||
|
||||
|
||||
What i did for this period code-wise is simply write a new function or script everytime i needed something, from there i'd just call said function in an adequetly named "main"
|
||||
file to test the function live. To this extent i only made a few files/functions to accomodate this class subject listed below:
|
||||
|
||||
- Main.py: As the name suggests this file's only purpose (as shown above) is to call upon a function from another file.
|
||||
- Colorwave: This file is used to define color to send to a ledstrip. This file is also equipped to test a led strip if the file is run as main.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from neopixel import Neopixel
|
||||
|
||||
numpix = 30
|
||||
strip = Neopixel(numpix, 0, 28, "GRB")
|
||||
# strip = Neopixel(numpsix, 0, 0, "GRBW")
|
||||
|
||||
red = (255, 0, 0)
|
||||
orange = (255, 50, 0)
|
||||
yellow = (255, 100, 0)
|
||||
green = (0, 255, 0)
|
||||
blue = (0, 0, 255)
|
||||
indigo = (100, 0, 90)
|
||||
violet = (200, 0, 100)
|
||||
colors_rgb = [red, orange, yellow, green, blue, indigo, violet]
|
||||
|
||||
while True:
|
||||
strip.rotate_right(1)
|
||||
time.sleep(0.15)
|
||||
strip.show()
|
||||
|
||||
Trivia
|
||||
|
||||
Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not. This code
|
||||
contains a lot of callable intergers to be used as a reference sheet to avoid clutter in the main code, it also gives the function to the ledstrip to move from left to right.
|
||||
|
||||
NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file with a full documentation on `github <https://github.com/adafruit/Adafruit_NeoPixel>`_.
|
||||
|
||||
.. collapse:: notes
|
||||
|
||||
This code contains all the technical functions of the ledstrip setup. The interesting part for the user are functinos such as "brightness", "show" and "rotate". Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the fun functions to create your own custom lighting.
|
||||
therefore it is a rather large file (text wise) with a full documentation on `github <https://github.com/adafruit/Adafruit_NeoPixel>`.
|
||||
This code contains all the technical functions of the ledstrip script. The interesting part for the user are functions such as **brightness**, **show** and **rotate**. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the *fun* functions to create your own custom lighting.
|
||||
|
||||
discolight_sl: This is the main file i'm currently using to stash all my functions in. For the moment this only includes some code i got from some `guy <https://git.herreweb.nl/EljakimHerrewijnen>`_
|
||||
called disco. My own code which is called police and a shutoff function. Because i'm too lazy to scroll for the functions i call them in a different file.
|
||||
|
||||
.. collapse:: Notes
|
||||
This code has very few interesting notes on how it functions: In the function: "discolight" we use a randomizer to set every pixel to some random rgb value. In the function:
|
||||
**police** we use a simpole calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take
|
||||
turns in who gets to light up first, creating a policelight effect.
|
||||
|
||||
This code has very few interesting notes, In the function: "discolight" we use a randomizer to set every pixel to some random rgb value. In the function :"police"
|
||||
we use a clever calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take turns
|
||||
in who gets to light up first, creating a policelight effect.
|
||||
The Exams
|
||||
|
||||
This code is a work in progress and will be continued in due time.
|
||||
I'll tell you straight up i failed the exams almost thrice due to a mixture of circumstance, lack of cricital knowledge, tunnel vision and as it's called in my own generation's
|
||||
words; *an issue of the skill* or *skill issue*. Since i generally find the fault with myself i tend to agree with the latter reason even if one exam was actually scuffed.
|
||||
|
||||
The exams revolved around being able to fetch data from a website, filter this data out to only show the data you want such as the latest uploaded temperature and wind direction.
|
||||
This data would be printed and the leds would be programmed to respond to the data with different collors (cold = 1-15 blue, hot 1-15 red stuff like that). The time given for this
|
||||
was about 3 days to figure out and turn into an essay with some proof. Now i knew my leds better than i knew everything else which was exactly the problem the first time,
|
||||
I could not figure out how to filter data and this caused me to crash with the grace of a piece of satelite space debris.
|
||||
|
||||
The second time i did an exam i was with one other guy. This time i actually had a decent idea of what i was supposed to do but there was a minor ever so slight inconvenience:
|
||||
The data you were supposed to collect was set up with a mqtt connection through a ssl connection. Now for context when i figured out this problem at the end of the 2nd day (roughly
|
||||
16-24 hours of work in). The ssl certificate system (in hindsight was a simple fix) was never mentioned or provided in the readers which caused me great annoyance. If it looks
|
||||
bad right now don't worry it gets worse. I mailed my teacher about it who neither knew nor cared about the issue at the time so i tried to just make things work by generating
|
||||
data myself and working out every solution i could.
|
||||
|
||||
Whilst doing all of this i learned a lot more about python and found out i'm very easily electrically charged. Yeah AD study's are something sometimes, just not a good something.
|
||||
|
||||
So i mentioned it would get worse and a random guy, now i made an essay with proof and an unhealthy dosis of "office passive aggression" to which I was asked and i quote: "How do
|
||||
you put so much malevolence and hatred in an essay?". Well i showed up hoping my extensive work would at least get me a pass on the subject, I was wrong: My teacher said that due
|
||||
asking the AI to generate data to test my code he couldn't trust my work even though i could not collect the data myself, to add insult to injury he blatanly ignored his connection
|
||||
mishap pulling the bureacratic move called "pleading oopsie daisy" and "It's a hbo study you should figure it out yourself bozo". To top it off the other guy had sent nothing
|
||||
in stating "if it didn't work he couldn't send it" and gave up early on. So to sum it up i spent 3 days debugging something unsolvable at the time and got another shot for my trouble,
|
||||
the other guy also got another shot for doing absolutely nothing. So the teacher would send another exam (3rd) later that week where he'd solve the connection part to ensure there was
|
||||
no faulty information or code on our side. Now i knew the other guy was notorious for using AI from which i restrain so my frustration was immense and understandable at this point. Since
|
||||
i got told to my face that my effort didn't matter in the slightest I opted to bureacraticly engage my teacher to a breaking point from that point on to ensure he would not pull any shenanigans
|
||||
like this again. (I continue this practice to this day.)
|
||||
|
||||
The third exam i did pass a week later and it felt hollow as a dead piece of bark. The code i wrote changed quite a lot since i copied from github and AI alike if i didn't understand something
|
||||
since at this point i didn't really give a hoot whether my code was or looked authentic since i got memed on by my teachers so I decided to return similar effort. This marks the beginning of
|
||||
the time where i stopped caring about how i got my code provided it worked first.
|
||||
|
||||
Much like how I started my code i divided everything up in functions but did throw at intergers into a singular file since at this point i did not care anymore. To quickly summarize everything;
|
||||
The code is given all functions to connect to the local wifi and to the mqtt broker afterwards. The last exam did not care for the ledstrip and just wanted to see a led output so it
|
||||
has a place alongside the print lines to show if the water was rising or falling. One of the tasks was to write the data of every hour or so to a csv file, for this I used the time of the
|
||||
watermeter against itself since it only updated every 10-15 minutes and made the pico write the data down every 5th time. I will say that the tricks employed in this code are interesting
|
||||
since it has a heavy focus on just being lazy but efficient which is a programmer's quota.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
import network
|
||||
from machine import Pin
|
||||
from simple import MQTTClient
|
||||
# import csv #i can't figure out why yet but csv disables the whole script
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
wlan.connect("ssid","ssidpwd")
|
||||
|
||||
ledup = Pin(16, Pin.OUT)
|
||||
leddown = Pin(17, Pin.OUT)
|
||||
|
||||
time.sleep(5)
|
||||
print(wlan.isconnected())
|
||||
|
||||
# Use the correct MQTT server address and topic
|
||||
mqtt_server = '825c912987534f048c3fbc28bb6ad943.s2.eu.hivemq.cloud'
|
||||
topic_sub = b'waterstand'
|
||||
|
||||
|
||||
def sub_cb(topic, msg):
|
||||
global preval, counter #create all variables used to avoid undefined errors
|
||||
topic_str = topic.decode("utf-8") # remove unwanted characters using the strip() method https://www.w3schools.com/python/ref_string_strip.asp
|
||||
# remove unwanted characters using the strip() method
|
||||
msg_str = msg.decode("utf-8").strip()
|
||||
print("New message on topic {}".format(topic_str))
|
||||
# value = msg_str[-4:].replace(';', '') # this is the first method i used to ensure if the leds function worked, this however had problems with slicing giving me characters back which crashed the program
|
||||
print(f"Received Data: Topic = {topic_str}, Msg = {msg_str}")
|
||||
# get the last item of the resulting list sorted by ;
|
||||
value = msg_str.split(";")[-1]
|
||||
print("Value: ", value)
|
||||
newval = int(value)
|
||||
if newval != preval: # compare new value with previous value
|
||||
if newval > preval:
|
||||
ledup.on()
|
||||
leddown.off()
|
||||
print("value going up")
|
||||
elif newval < preval:
|
||||
leddown.on()
|
||||
ledup.off()
|
||||
print("value going down")
|
||||
preval = newval # update previous value
|
||||
|
||||
counter += 1
|
||||
if counter == 4:
|
||||
csvfile2 = open("data.csv", "a") #turns out write overwrites the entire file and i'm just a moron
|
||||
# to ensure this works i'm using the stripped string version so no b or /n but ; stays
|
||||
csvfile2.write(str(msg_str).replace(';', ',') + ",")
|
||||
print('Data written to CSV file')
|
||||
# Reset counter
|
||||
counter = 0
|
||||
# data = [] #initially i thought i needed a list and to call or clear the last function every time
|
||||
# # # hoe kom je van de b" en de \n af? zoek dat op.
|
||||
|
||||
def connectMQTT():
|
||||
client = MQTTClient(client_id=b'1061348',
|
||||
server=mqtt_server,
|
||||
port=8883,
|
||||
user=b"racdata",
|
||||
password=b"herkansingpython2",
|
||||
keepalive=7200,
|
||||
ssl=True,
|
||||
ssl_params={'server_hostname': mqtt_server}
|
||||
)
|
||||
client.set_callback(sub_cb)
|
||||
client.connect()
|
||||
print('Connected to %s MQTT Broker' % (mqtt_server))
|
||||
return client
|
||||
|
||||
# If failed to connect to the MQTT broker, reset the machine
|
||||
|
||||
|
||||
def reconnect():
|
||||
print('Failed to connect to MQTT Broker. Reconnecting...')
|
||||
time.sleep(5)
|
||||
machine.reset()
|
||||
|
||||
|
||||
# Try to connect to the MQTT broker, if failed, reconnect
|
||||
try:
|
||||
client = connectMQTT()
|
||||
except OSError as e:
|
||||
reconnect()
|
||||
|
||||
preval = 0 # old first value
|
||||
counter = 0 # Initialize the counter
|
||||
while True:
|
||||
# ledup.on()
|
||||
time.sleep(5)
|
||||
# ledup.off()
|
||||
client.subscribe(topic_sub) # subscribe to the topic
|
||||
time.sleep(1)
|
||||
|
||||
What you can take away from all this is that much like the modern workplace hard work does not actually pay, efficient, lazy, idiotproof and preresearched work pays. It's not
|
||||
about how hard you try or how committed you are it's about if it works and how good it works. The strongest sword wains when the wielder is weak so be smart and disciplined.
|
@ -39,13 +39,21 @@
|
||||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Overview:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Ithamar’s Agenda</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html">Cijferlijst</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html#herkansingen">herkansingen</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2023-2024:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Stage_J2P1.html">Stage/Internship</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -77,10 +85,10 @@
|
||||
<p>Tabel van opdrachten</p>
|
||||
<table class="docutils align-default">
|
||||
<colgroup>
|
||||
<col style="width: 24%" />
|
||||
<col style="width: 28%" />
|
||||
<col style="width: 42%" />
|
||||
<col style="width: 7%" />
|
||||
<col style="width: 33%" />
|
||||
<col style="width: 20%" />
|
||||
<col style="width: 32%" />
|
||||
<col style="width: 15%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="row-odd"><th class="head"><p>Wat</p></th>
|
||||
@ -111,40 +119,25 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>HerExamen 2 SQLite</p></td>
|
||||
<td></td>
|
||||
<td><p>lees dit keer iets meer door</p></td>
|
||||
<td></td>
|
||||
<tr class="row-odd"><td><p>Krane impact</p></td>
|
||||
<td><p>01/07/2024</p></td>
|
||||
<td><p>Fall Ost</p></td>
|
||||
<td><p>Ongoing</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Nederlands her-Examen 3</p></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<tr class="row-even"><td><p>internship essay</p></td>
|
||||
<td><p>september</p></td>
|
||||
<td><p>initial defeat</p></td>
|
||||
<td><p>Ongoing</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Stage + opdracht</p></td>
|
||||
<td><p>januari</p></td>
|
||||
<td><p>moet voor periode 3 januri geregeld zijn</p></td>
|
||||
<td></td>
|
||||
<tr class="row-odd"><td><p>Workplace Research</p></td>
|
||||
<td><p>???</p></td>
|
||||
<td><p>Last man standing</p></td>
|
||||
<td><p>tbd</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Afstudeerstage + opdracht</p></td>
|
||||
<td><p>20 januari</p></td>
|
||||
<td><p>vereist voor het cijfer van SQLite</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Keuzevak voor jaar 2</p></td>
|
||||
<td><p>2023-2024</p></td>
|
||||
<td><p>opmaak voor gefaald zorgrobot, japans misschien?</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Haal firebeetle op van paul</p></td>
|
||||
<td><p>4 september 2023 - 28 juli 2024</p></td>
|
||||
<td><p>uitleensel</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Fnaf movie october</p></td>
|
||||
<td><p>27 october</p></td>
|
||||
<td><p>Groep/solo uitje</p></td>
|
||||
<td></td>
|
||||
<tr class="row-even"><td><p>Zenoh casus</p></td>
|
||||
<td><p>???</p></td>
|
||||
<td><p>initiative</p></td>
|
||||
<td><p>tbd</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -39,13 +39,21 @@
|
||||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<p class="caption" role="heading"><span class="caption-text">Overview:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="agenda.html">Ithamar’s Agenda</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Cijferlijst</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#herkansingen">herkansingen</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2023-2024:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Stage_J2P1.html">Stage/Internship</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -162,6 +170,56 @@
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Data</p></td>
|
||||
<td><p>9.0</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>RSP</p></td>
|
||||
<td><p>8.5</p></td>
|
||||
<td><p>4 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>UX</p></td>
|
||||
<td><p>5.5</p></td>
|
||||
<td><p>4 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Ethiek</p></td>
|
||||
<td><p>8.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Cisco Intergraal</p></td>
|
||||
<td><p>8.8</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Data</p></td>
|
||||
<td><p>9.0</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>Design research</p></td>
|
||||
<td><p>8.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>slc final assesment</p></td>
|
||||
<td><p>7.0</p></td>
|
||||
<td><p>5 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>State of the art 1</p></td>
|
||||
<td><p>9.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>State of the art 2</p></td>
|
||||
<td><p>9.5</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
@ -169,10 +227,10 @@
|
||||
<h1>herkansingen<a class="headerlink" href="#herkansingen" title="Permalink to this heading"></a></h1>
|
||||
<table class="docutils align-default">
|
||||
<colgroup>
|
||||
<col style="width: 28%" />
|
||||
<col style="width: 13%" />
|
||||
<col style="width: 16%" />
|
||||
<col style="width: 42%" />
|
||||
<col style="width: 21%" />
|
||||
<col style="width: 10%" />
|
||||
<col style="width: 20%" />
|
||||
<col style="width: 49%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="row-odd"><td><p>Vak</p></td>
|
||||
@ -180,29 +238,24 @@
|
||||
<td><p>studiepunten</p></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>User Experience</p></td>
|
||||
<td><p>5.2</p></td>
|
||||
<td><p>4 studiepunten</p></td>
|
||||
<tr class="row-even"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>SQLite</p></td>
|
||||
<td><p>4.2</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<tr class="row-odd"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>zorgrobot</p></td>
|
||||
<td><p>5.0</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td><p>Keuzevak (niet voor herhaling vatbaar)</p></td>
|
||||
<tr class="row-even"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p>OP2 studieloopbaancoaching</p></td>
|
||||
<td><p>Onvoldoende</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<td><p>Forgor thrice, couldn’t redo b4 new year</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p>Nederlands</p></td>
|
||||
<td><p>5.3</p></td>
|
||||
<td><p>2 studiepunten</p></td>
|
||||
<tr class="row-odd"><td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -39,13 +39,22 @@
|
||||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<p class="caption" role="heading"><span class="caption-text">Overview:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="agenda.html">Ithamar’s Agenda</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html">Cijferlijst</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html#herkansingen">herkansingen</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2023-2024:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Stage_J2P1.html">Stage/Internship</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -75,27 +84,33 @@
|
||||
<section id="escape-room-ithamar">
|
||||
<h1>escape-room ithamar<a class="headerlink" href="#escape-room-ithamar" title="Permalink to this heading"></a></h1>
|
||||
<p>Documentatie voor ithamar’s escaperoom.</p>
|
||||
<p>Voor jaar 1 periode 2 van mijn studie IoT moet ik een escaperoom maken met een arduino in een groepje. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de werkplaats arduino.</p>
|
||||
<p>Het groepje waarbij ik zit heeft als thema: horror, ondanks dit thema is de echte horror een doos vinden om de escaperoom uit te maken
|
||||
en op tijd de puzzles te maken en te kunnen verwerken in deze doos.</p>
|
||||
<p>De puzzel die ik wil maken is afgeleid van de <a class="reference external" href="https://www.youtube.com/watch?v=VaPQGiTq8Bc">oneshot color puzzle</a></p>
|
||||
<p>Voor jaar 1 periode 2 van de studie Internet of Things moeten de studenten in een groepje een escaperoom maken met arduino’s. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de periode bij het vak ‘werkplaats arduino’ om creativiteit en affiniteit te demonstreren binnen het vak.</p>
|
||||
<p>Het groepje waarbij ik zat heeft als thema: horror, het denkproces achter dit thema is om een authentieke escaperoom te imiteren door de puzzels op een logische manier op elkaar te laten
|
||||
aansluiten. Het concept achter de escaperoom was om een doos te bouwen uit plywood en de 4 horizontale zijdes te gebruiken om de puzzels in te bouwen en zo klokwijs op elkaar aan te sluiten.</p>
|
||||
<p>De puzzel die ik heb gemaakt is afgeleid van de <a class="reference external" href="https://www.youtube.com/watch?v=VaPQGiTq8Bc">oneshot color puzzle</a> van de 2014 console game ‘oneshot’. Bij deze puzzel moet de speler aan de hand
|
||||
van 5 knoppen de juiste kleur op eenp positie krijgen zonder te weten in welke volgorde deze moet.</p>
|
||||
<img alt="_images/design.png" src="_images/design.png" />
|
||||
<p>Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, maar om kabels te besparen zullen we dit vervangen met leds van een
|
||||
WS2812B. Hiervoor is een simpele sketch gemaakt om vanaf te werken.</p>
|
||||
<img alt="_images/nwsketch.png" src="_images/nwsketch.png" />
|
||||
<p>8 december: de puzzel is fysiek compleet maar moet nog geprogrammeerd worden en de bekabeling gecontroleerd, zodra dit gedeelte klaar is zijn er
|
||||
nog 2 mogelijke problemen met het gehele project: de puzzel naar puzzel communicatie en de intergratie van in de escapedoos.</p>
|
||||
<p>Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, om ruimte en praktische redenen werden de lampjes later vervangen met led-strips om bekabeling en troubleshooting
|
||||
een simpler process te maken. Dit liet ook toe dat de hele puzzel op een breakboard kon worden gesoldeerd voor een meer robust resultaat om goed in hout te kunnen worden gezet.</p>
|
||||
<img alt="_images/nanobuild.jpg" src="_images/nanobuild.jpg" />
|
||||
<p>11 december: De puzzel is nog in productie maar het finale product is besloten, om het concept van de puzzel over te brengen heb ik ook een flowchart
|
||||
gemaakt om het process uit te leggen</p>
|
||||
<img alt="escape-room/oneshot_illustration.png" src="escape-room/oneshot_illustration.png" />
|
||||
</section>
|
||||
<section id="code">
|
||||
<h1>code<a class="headerlink" href="#code" title="Permalink to this heading"></a></h1>
|
||||
<p>De code van dit prototype was geschreven in arduino/C++. Om de context van de code goed te begrijpen moet het spel ook begrepen worden: wanneer de puzzel opstart wordt er een willekeurige code
|
||||
gegenereerd van 5 cijfers tussen 1 en 5. Elk cijfer staat paralel met een kleur van led strips. Wanneer de gebruiker op de 6e knop drukt om de kleurcode te controleren krijgt deze feedback over
|
||||
hoeveel kleuren er correct zijn maar niet welke. De gebruiker kan dus alleen uitmaken welke kleur er correct is door af te leiden of er meer of minder correcte antwoorden zijn op basis van de feedback.
|
||||
Voor de gebruiker wordt de code dus een kwestie vane de kleuren blijven aanpassen op basis van welke score deze krijgt net zoals het raden van een cijfercombinatie van een slot.</p>
|
||||
<p>De led-strips worden indvidueel aangestuurd door de knoppen. Elke keer dat de konp word ingedrukt wordt een waarde van de knop aangepast om overeen te komen met een kleur. Denk dus rood 1, groen 2 etc.
|
||||
.. image:: escape-room/oneshot_ledset.png</p>
|
||||
<p>De waardes van de voorgenoemde led-strips worden hergebruikt voor het spel: De code die gegenereerd wordt heeft een vaste positie in een array. Als de gebruiker een lichtje veranderd via de knoppen dan wordt
|
||||
achter de schermen door de gebruiker een eigen code gebouwd met de waardes van de lichtjes. dus denk een combinatie van groen, geel, blauw en rood als 3, 4, 1 en 5. Wanneer de gebruiker de code controleerd word
|
||||
de array van de puzzel vergeleken met de array van de gebruiker. voor elk deel van de array’s die niet overkomen word een fout waarde opgeteld, op basis van deze waarde krijgt de gebruiker te zien hoeveel er fout en goed waren.
|
||||
.. image:: escape-room/oneshot_arraycheck.png</p>
|
||||
<img alt="_images/oneshot_pwdgen.png" src="_images/oneshot_pwdgen.png" />
|
||||
<img alt="_images/flowchart.png" src="_images/flowchart.png" />
|
||||
<p>27 januari: De puzzel is in hout gezet voor de presentatie, helaas was bij de decoratie de opbouw van de puzzel niet in consideratie genomen. Hierdoor is de originele
|
||||
decoratie niet gebruikt in het eindproduct. Dezelfde dag zijn de puzzels samen gezet in een doos en gepresenteerd met succes. Het project werd gecijferd over de hele groep maar
|
||||
ik kan met zekerheid zeggen dat mijn onderdeel van het project genoeg heeft toegevoegd om het finale resultaat acceptabel te maken. Op het moment dat ik mijn onderdeel
|
||||
finaliseerde besloot ik geen kansen te nemen en voegde ik instructies toe om feedback te verwerken in het project voor het geval het project erg schrijnend werd.</p>
|
||||
<p>Toen alles gezegd en gedaan was kwam er een groepscijfer uit van 6.1; normaal zou dit een middelmatig/onverschillig resultaat zijn maar sinds dit een herkansing,
|
||||
groepscijfer en het vak 4 studiepunten waard was nam ik het graag aan met gratie.</p>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
|
@ -47,6 +47,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -94,6 +95,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="P4_realiseren.html#periode-3">Periode 3</a></li>
|
||||
|
@ -39,14 +39,20 @@
|
||||
</form>
|
||||
</div>
|
||||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<p class="caption" role="heading"><span class="caption-text">Overview:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="agenda.html">Ithamar’s Agenda</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html">Cijferlijst</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="cijfers.html#herkansingen">herkansingen</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
<p class="caption" role="heading"><span class="caption-text">2023-2024:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Stage_J2P1.html">Stage/Internship</a></li>
|
||||
</ul>
|
||||
|
||||
@ -81,26 +87,182 @@
|
||||
learning to work with loops and statements. Through these projects we will be required to rely less on simple inputs and imports and more on thinking out of the box.</p>
|
||||
<p>The files refferenced can be found in <a class="reference external" href="https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source">https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source</a> or the git repository.
|
||||
Apart from micropython no other packages have to be installed.</p>
|
||||
<p>Notable files</p>
|
||||
<p>Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not.</p>
|
||||
<details class="summary-notes">
|
||||
<summary>Notes</summary><p>This code contains a lot of callable intergers, it also gives the function to the ledstrip to move from left to right.</p>
|
||||
</details><p>NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file with a full documentation on <a class="reference external" href="https://github.com/adafruit/Adafruit_NeoPixel">github</a>.</p>
|
||||
<blockquote>
|
||||
<div><details class="summary-notes">
|
||||
<summary>notes</summary><p>This code contains all the technical functions of the ledstrip setup. The interesting part for the user are functinos such as “brightness”, “show” and “rotate”. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the fun functions to create your own custom lighting.</p>
|
||||
</details></div></blockquote>
|
||||
<div><div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">discolight_sl</span> <span class="kn">import</span> <span class="o">*</span>
|
||||
|
||||
<span class="c1"># DiscoLed()</span>
|
||||
<span class="n">police</span><span class="p">()</span>
|
||||
<span class="c1"># shutoff()</span>
|
||||
<span class="c1"># Riveting stuff i know</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div></blockquote>
|
||||
<p>What i did for this period code-wise is simply write a new function or script everytime i needed something, from there i’d just call said function in an adequetly named “main”
|
||||
file to test the function live. To this extent i only made a few files/functions to accomodate this class subject listed below:</p>
|
||||
<ul class="simple">
|
||||
<li><p>Main.py: As the name suggests this file’s only purpose (as shown above) is to call upon a function from another file.</p></li>
|
||||
<li><p>Colorwave: This file is used to define color to send to a ledstrip. This file is also equipped to test a led strip if the file is run as main.</p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">neopixel</span> <span class="kn">import</span> <span class="n">Neopixel</span>
|
||||
|
||||
<span class="n">numpix</span> <span class="o">=</span> <span class="mi">30</span>
|
||||
<span class="n">strip</span> <span class="o">=</span> <span class="n">Neopixel</span><span class="p">(</span><span class="n">numpix</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">28</span><span class="p">,</span> <span class="s2">"GRB"</span><span class="p">)</span>
|
||||
<span class="c1"># strip = Neopixel(numpsix, 0, 0, "GRBW")</span>
|
||||
|
||||
<span class="n">red</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">orange</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">yellow</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">green</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">blue</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">)</span>
|
||||
<span class="n">indigo</span> <span class="o">=</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">90</span><span class="p">)</span>
|
||||
<span class="n">violet</span> <span class="o">=</span> <span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
|
||||
<span class="n">colors_rgb</span> <span class="o">=</span> <span class="p">[</span><span class="n">red</span><span class="p">,</span> <span class="n">orange</span><span class="p">,</span> <span class="n">yellow</span><span class="p">,</span> <span class="n">green</span><span class="p">,</span> <span class="n">blue</span><span class="p">,</span> <span class="n">indigo</span><span class="p">,</span> <span class="n">violet</span><span class="p">]</span>
|
||||
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="n">strip</span><span class="o">.</span><span class="n">rotate_right</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.15</span><span class="p">)</span>
|
||||
<span class="n">strip</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Trivia</p>
|
||||
<p>Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not. This code
|
||||
contains a lot of callable intergers to be used as a reference sheet to avoid clutter in the main code, it also gives the function to the ledstrip to move from left to right.</p>
|
||||
<p>NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file (text wise) with a full documentation on <cite>github <https://github.com/adafruit/Adafruit_NeoPixel></cite>.
|
||||
This code contains all the technical functions of the ledstrip script. The interesting part for the user are functions such as <strong>brightness</strong>, <strong>show</strong> and <strong>rotate</strong>. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the <em>fun</em> functions to create your own custom lighting.</p>
|
||||
<p>discolight_sl: This is the main file i’m currently using to stash all my functions in. For the moment this only includes some code i got from some <a class="reference external" href="https://git.herreweb.nl/EljakimHerrewijnen">guy</a>
|
||||
called disco. My own code which is called police and a shutoff function. Because i’m too lazy to scroll for the functions i call them in a different file.</p>
|
||||
<blockquote>
|
||||
<div><details class="summary-notes">
|
||||
<summary>Notes</summary><p>This code has very few interesting notes, In the function: “discolight” we use a randomizer to set every pixel to some random rgb value. In the function :”police”
|
||||
we use a clever calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take turns
|
||||
in who gets to light up first, creating a policelight effect.</p>
|
||||
</details></div></blockquote>
|
||||
<p>This code is a work in progress and will be continued in due time.</p>
|
||||
called disco. My own code which is called police and a shutoff function. Because i’m too lazy to scroll for the functions i call them in a different file.
|
||||
This code has very few interesting notes on how it functions: In the function: “discolight” we use a randomizer to set every pixel to some random rgb value. In the function:
|
||||
<strong>police</strong> we use a simpole calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take
|
||||
turns in who gets to light up first, creating a policelight effect.</p>
|
||||
<p>The Exams</p>
|
||||
<p>I’ll tell you straight up i failed the exams almost thrice due to a mixture of circumstance, lack of cricital knowledge, tunnel vision and as it’s called in my own generation’s
|
||||
words; <em>an issue of the skill</em> or <em>skill issue</em>. Since i generally find the fault with myself i tend to agree with the latter reason even if one exam was actually scuffed.</p>
|
||||
<p>The exams revolved around being able to fetch data from a website, filter this data out to only show the data you want such as the latest uploaded temperature and wind direction.
|
||||
This data would be printed and the leds would be programmed to respond to the data with different collors (cold = 1-15 blue, hot 1-15 red stuff like that). The time given for this
|
||||
was about 3 days to figure out and turn into an essay with some proof. Now i knew my leds better than i knew everything else which was exactly the problem the first time,
|
||||
I could not figure out how to filter data and this caused me to crash with the grace of a piece of satelite space debris.</p>
|
||||
<p>The second time i did an exam i was with one other guy. This time i actually had a decent idea of what i was supposed to do but there was a minor ever so slight inconvenience:
|
||||
The data you were supposed to collect was set up with a mqtt connection through a ssl connection. Now for context when i figured out this problem at the end of the 2nd day (roughly
|
||||
16-24 hours of work in). The ssl certificate system (in hindsight was a simple fix) was never mentioned or provided in the readers which caused me great annoyance. If it looks
|
||||
bad right now don’t worry it gets worse. I mailed my teacher about it who neither knew nor cared about the issue at the time so i tried to just make things work by generating
|
||||
data myself and working out every solution i could.</p>
|
||||
<p>Whilst doing all of this i learned a lot more about python and found out i’m very easily electrically charged. Yeah AD study’s are something sometimes, just not a good something.</p>
|
||||
<p>So i mentioned it would get worse and a random guy, now i made an essay with proof and an unhealthy dosis of “office passive aggression” to which I was asked and i quote: “How do
|
||||
you put so much malevolence and hatred in an essay?”. Well i showed up hoping my extensive work would at least get me a pass on the subject, I was wrong: My teacher said that due
|
||||
asking the AI to generate data to test my code he couldn’t trust my work even though i could not collect the data myself, to add insult to injury he blatanly ignored his connection
|
||||
mishap pulling the bureacratic move called “pleading oopsie daisy” and “It’s a hbo study you should figure it out yourself bozo”. To top it off the other guy had sent nothing
|
||||
in stating “if it didn’t work he couldn’t send it” and gave up early on. So to sum it up i spent 3 days debugging something unsolvable at the time and got another shot for my trouble,
|
||||
the other guy also got another shot for doing absolutely nothing. So the teacher would send another exam (3rd) later that week where he’d solve the connection part to ensure there was
|
||||
no faulty information or code on our side. Now i knew the other guy was notorious for using AI from which i restrain so my frustration was immense and understandable at this point. Since
|
||||
i got told to my face that my effort didn’t matter in the slightest I opted to bureacraticly engage my teacher to a breaking point from that point on to ensure he would not pull any shenanigans
|
||||
like this again. (I continue this practice to this day.)</p>
|
||||
<p>The third exam i did pass a week later and it felt hollow as a dead piece of bark. The code i wrote changed quite a lot since i copied from github and AI alike if i didn’t understand something
|
||||
since at this point i didn’t really give a hoot whether my code was or looked authentic since i got memed on by my teachers so I decided to return similar effort. This marks the beginning of
|
||||
the time where i stopped caring about how i got my code provided it worked first.</p>
|
||||
<p>Much like how I started my code i divided everything up in functions but did throw at intergers into a singular file since at this point i did not care anymore. To quickly summarize everything;
|
||||
The code is given all functions to connect to the local wifi and to the mqtt broker afterwards. The last exam did not care for the ledstrip and just wanted to see a led output so it
|
||||
has a place alongside the print lines to show if the water was rising or falling. One of the tasks was to write the data of every hour or so to a csv file, for this I used the time of the
|
||||
watermeter against itself since it only updated every 10-15 minutes and made the pico write the data down every 5th time. I will say that the tricks employed in this code are interesting
|
||||
since it has a heavy focus on just being lazy but efficient which is a programmer’s quota.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">time</span>
|
||||
<span class="kn">import</span> <span class="nn">network</span>
|
||||
<span class="kn">from</span> <span class="nn">machine</span> <span class="kn">import</span> <span class="n">Pin</span>
|
||||
<span class="kn">from</span> <span class="nn">simple</span> <span class="kn">import</span> <span class="n">MQTTClient</span>
|
||||
<span class="c1"># import csv #i can't figure out why yet but csv disables the whole script</span>
|
||||
|
||||
<span class="n">wlan</span> <span class="o">=</span> <span class="n">network</span><span class="o">.</span><span class="n">WLAN</span><span class="p">(</span><span class="n">network</span><span class="o">.</span><span class="n">STA_IF</span><span class="p">)</span>
|
||||
<span class="n">wlan</span><span class="o">.</span><span class="n">active</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">wlan</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">"ssid"</span><span class="p">,</span><span class="s2">"ssidpwd"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ledup</span> <span class="o">=</span> <span class="n">Pin</span><span class="p">(</span><span class="mi">16</span><span class="p">,</span> <span class="n">Pin</span><span class="o">.</span><span class="n">OUT</span><span class="p">)</span>
|
||||
<span class="n">leddown</span> <span class="o">=</span> <span class="n">Pin</span><span class="p">(</span><span class="mi">17</span><span class="p">,</span> <span class="n">Pin</span><span class="o">.</span><span class="n">OUT</span><span class="p">)</span>
|
||||
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">wlan</span><span class="o">.</span><span class="n">isconnected</span><span class="p">())</span>
|
||||
|
||||
<span class="c1"># Use the correct MQTT server address and topic</span>
|
||||
<span class="n">mqtt_server</span> <span class="o">=</span> <span class="s1">'825c912987534f048c3fbc28bb6ad943.s2.eu.hivemq.cloud'</span>
|
||||
<span class="n">topic_sub</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">'waterstand'</span>
|
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">sub_cb</span><span class="p">(</span><span class="n">topic</span><span class="p">,</span> <span class="n">msg</span><span class="p">):</span>
|
||||
<span class="k">global</span> <span class="n">preval</span><span class="p">,</span> <span class="n">counter</span> <span class="c1">#create all variables used to avoid undefined errors</span>
|
||||
<span class="n">topic_str</span> <span class="o">=</span> <span class="n">topic</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> <span class="c1"># remove unwanted characters using the strip() method https://www.w3schools.com/python/ref_string_strip.asp</span>
|
||||
<span class="c1"># remove unwanted characters using the strip() method</span>
|
||||
<span class="n">msg_str</span> <span class="o">=</span> <span class="n">msg</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"New message on topic </span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">topic_str</span><span class="p">))</span>
|
||||
<span class="c1"># value = msg_str[-4:].replace(';', '') # this is the first method i used to ensure if the leds function worked, this however had problems with slicing giving me characters back which crashed the program</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Received Data: Topic = </span><span class="si">{</span><span class="n">topic_str</span><span class="si">}</span><span class="s2">, Msg = </span><span class="si">{</span><span class="n">msg_str</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="c1"># get the last item of the resulting list sorted by ;</span>
|
||||
<span class="n">value</span> <span class="o">=</span> <span class="n">msg_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">";"</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"Value: "</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
|
||||
<span class="n">newval</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">newval</span> <span class="o">!=</span> <span class="n">preval</span><span class="p">:</span> <span class="c1"># compare new value with previous value</span>
|
||||
<span class="k">if</span> <span class="n">newval</span> <span class="o">></span> <span class="n">preval</span><span class="p">:</span>
|
||||
<span class="n">ledup</span><span class="o">.</span><span class="n">on</span><span class="p">()</span>
|
||||
<span class="n">leddown</span><span class="o">.</span><span class="n">off</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"value going up"</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="n">newval</span> <span class="o"><</span> <span class="n">preval</span><span class="p">:</span>
|
||||
<span class="n">leddown</span><span class="o">.</span><span class="n">on</span><span class="p">()</span>
|
||||
<span class="n">ledup</span><span class="o">.</span><span class="n">off</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"value going down"</span><span class="p">)</span>
|
||||
<span class="n">preval</span> <span class="o">=</span> <span class="n">newval</span> <span class="c1"># update previous value</span>
|
||||
|
||||
<span class="n">counter</span> <span class="o">+=</span> <span class="mi">1</span>
|
||||
<span class="k">if</span> <span class="n">counter</span> <span class="o">==</span> <span class="mi">4</span><span class="p">:</span>
|
||||
<span class="n">csvfile2</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data.csv"</span><span class="p">,</span> <span class="s2">"a"</span><span class="p">)</span> <span class="c1">#turns out write overwrites the entire file and i'm just a moron</span>
|
||||
<span class="c1"># to ensure this works i'm using the stripped string version so no b or /n but ; stays</span>
|
||||
<span class="n">csvfile2</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg_str</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">';'</span><span class="p">,</span> <span class="s1">','</span><span class="p">)</span> <span class="o">+</span> <span class="s2">","</span><span class="p">)</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Data written to CSV file'</span><span class="p">)</span>
|
||||
<span class="c1"># Reset counter</span>
|
||||
<span class="n">counter</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
<span class="c1"># data = [] #initially i thought i needed a list and to call or clear the last function every time</span>
|
||||
<span class="c1"># # # hoe kom je van de b" en de \n af? zoek dat op.</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">connectMQTT</span><span class="p">():</span>
|
||||
<span class="n">client</span> <span class="o">=</span> <span class="n">MQTTClient</span><span class="p">(</span><span class="n">client_id</span><span class="o">=</span><span class="sa">b</span><span class="s1">'1061348'</span><span class="p">,</span>
|
||||
<span class="n">server</span><span class="o">=</span><span class="n">mqtt_server</span><span class="p">,</span>
|
||||
<span class="n">port</span><span class="o">=</span><span class="mi">8883</span><span class="p">,</span>
|
||||
<span class="n">user</span><span class="o">=</span><span class="sa">b</span><span class="s2">"racdata"</span><span class="p">,</span>
|
||||
<span class="n">password</span><span class="o">=</span><span class="sa">b</span><span class="s2">"herkansingpython2"</span><span class="p">,</span>
|
||||
<span class="n">keepalive</span><span class="o">=</span><span class="mi">7200</span><span class="p">,</span>
|
||||
<span class="n">ssl</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">ssl_params</span><span class="o">=</span><span class="p">{</span><span class="s1">'server_hostname'</span><span class="p">:</span> <span class="n">mqtt_server</span><span class="p">}</span>
|
||||
<span class="p">)</span>
|
||||
<span class="n">client</span><span class="o">.</span><span class="n">set_callback</span><span class="p">(</span><span class="n">sub_cb</span><span class="p">)</span>
|
||||
<span class="n">client</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Connected to </span><span class="si">%s</span><span class="s1"> MQTT Broker'</span> <span class="o">%</span> <span class="p">(</span><span class="n">mqtt_server</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">client</span>
|
||||
|
||||
<span class="c1"># If failed to connect to the MQTT broker, reset the machine</span>
|
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">reconnect</span><span class="p">():</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Failed to connect to MQTT Broker. Reconnecting...'</span><span class="p">)</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="n">machine</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
|
||||
|
||||
|
||||
<span class="c1"># Try to connect to the MQTT broker, if failed, reconnect</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">client</span> <span class="o">=</span> <span class="n">connectMQTT</span><span class="p">()</span>
|
||||
<span class="k">except</span> <span class="ne">OSError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">reconnect</span><span class="p">()</span>
|
||||
|
||||
<span class="n">preval</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># old first value</span>
|
||||
<span class="n">counter</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># Initialize the counter</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="c1"># ledup.on()</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="c1"># ledup.off()</span>
|
||||
<span class="n">client</span><span class="o">.</span><span class="n">subscribe</span><span class="p">(</span><span class="n">topic_sub</span><span class="p">)</span> <span class="c1"># subscribe to the topic</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>What you can take away from all this is that much like the modern workplace hard work does not actually pay, efficient, lazy, idiotproof and preresearched work pays. It’s not
|
||||
about how hard you try or how committed you are it’s about if it works and how good it works. The strongest sword wains when the wielder is weak so be smart and disciplined.</p>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
|
@ -47,6 +47,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -94,6 +95,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="P4_realiseren.html#periode-3">Periode 3</a></li>
|
||||
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
@ -87,26 +88,182 @@
|
||||
learning to work with loops and statements. Through these projects we will be required to rely less on simple inputs and imports and more on thinking out of the box.</p>
|
||||
<p>The files refferenced can be found in <a class="reference external" href="https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source">https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source</a> or the git repository.
|
||||
Apart from micropython no other packages have to be installed.</p>
|
||||
<p>Notable files</p>
|
||||
<p>Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not.</p>
|
||||
<details class="summary-notes">
|
||||
<summary>Notes</summary><p>This code contains a lot of callable intergers, it also gives the function to the ledstrip to move from left to right.</p>
|
||||
</details><p>NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file with a full documentation on <a class="reference external" href="https://github.com/adafruit/Adafruit_NeoPixel">github</a>.</p>
|
||||
<blockquote>
|
||||
<div><details class="summary-notes">
|
||||
<summary>notes</summary><p>This code contains all the technical functions of the ledstrip setup. The interesting part for the user are functinos such as “brightness”, “show” and “rotate”. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the fun functions to create your own custom lighting.</p>
|
||||
</details></div></blockquote>
|
||||
<div><div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">discolight_sl</span> <span class="kn">import</span> <span class="o">*</span>
|
||||
|
||||
<span class="c1"># DiscoLed()</span>
|
||||
<span class="n">police</span><span class="p">()</span>
|
||||
<span class="c1"># shutoff()</span>
|
||||
<span class="c1"># Riveting stuff i know</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div></blockquote>
|
||||
<p>What i did for this period code-wise is simply write a new function or script everytime i needed something, from there i’d just call said function in an adequetly named “main”
|
||||
file to test the function live. To this extent i only made a few files/functions to accomodate this class subject listed below:</p>
|
||||
<ul class="simple">
|
||||
<li><p>Main.py: As the name suggests this file’s only purpose (as shown above) is to call upon a function from another file.</p></li>
|
||||
<li><p>Colorwave: This file is used to define color to send to a ledstrip. This file is also equipped to test a led strip if the file is run as main.</p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">neopixel</span> <span class="kn">import</span> <span class="n">Neopixel</span>
|
||||
|
||||
<span class="n">numpix</span> <span class="o">=</span> <span class="mi">30</span>
|
||||
<span class="n">strip</span> <span class="o">=</span> <span class="n">Neopixel</span><span class="p">(</span><span class="n">numpix</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">28</span><span class="p">,</span> <span class="s2">"GRB"</span><span class="p">)</span>
|
||||
<span class="c1"># strip = Neopixel(numpsix, 0, 0, "GRBW")</span>
|
||||
|
||||
<span class="n">red</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">orange</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">yellow</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">green</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||||
<span class="n">blue</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">)</span>
|
||||
<span class="n">indigo</span> <span class="o">=</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">90</span><span class="p">)</span>
|
||||
<span class="n">violet</span> <span class="o">=</span> <span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
|
||||
<span class="n">colors_rgb</span> <span class="o">=</span> <span class="p">[</span><span class="n">red</span><span class="p">,</span> <span class="n">orange</span><span class="p">,</span> <span class="n">yellow</span><span class="p">,</span> <span class="n">green</span><span class="p">,</span> <span class="n">blue</span><span class="p">,</span> <span class="n">indigo</span><span class="p">,</span> <span class="n">violet</span><span class="p">]</span>
|
||||
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="n">strip</span><span class="o">.</span><span class="n">rotate_right</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.15</span><span class="p">)</span>
|
||||
<span class="n">strip</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Trivia</p>
|
||||
<p>Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not. This code
|
||||
contains a lot of callable intergers to be used as a reference sheet to avoid clutter in the main code, it also gives the function to the ledstrip to move from left to right.</p>
|
||||
<p>NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file (text wise) with a full documentation on <cite>github <https://github.com/adafruit/Adafruit_NeoPixel></cite>.
|
||||
This code contains all the technical functions of the ledstrip script. The interesting part for the user are functions such as <strong>brightness</strong>, <strong>show</strong> and <strong>rotate</strong>. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the <em>fun</em> functions to create your own custom lighting.</p>
|
||||
<p>discolight_sl: This is the main file i’m currently using to stash all my functions in. For the moment this only includes some code i got from some <a class="reference external" href="https://git.herreweb.nl/EljakimHerrewijnen">guy</a>
|
||||
called disco. My own code which is called police and a shutoff function. Because i’m too lazy to scroll for the functions i call them in a different file.</p>
|
||||
<blockquote>
|
||||
<div><details class="summary-notes">
|
||||
<summary>Notes</summary><p>This code has very few interesting notes, In the function: “discolight” we use a randomizer to set every pixel to some random rgb value. In the function :”police”
|
||||
we use a clever calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take turns
|
||||
in who gets to light up first, creating a policelight effect.</p>
|
||||
</details></div></blockquote>
|
||||
<p>This code is a work in progress and will be continued in due time.</p>
|
||||
called disco. My own code which is called police and a shutoff function. Because i’m too lazy to scroll for the functions i call them in a different file.
|
||||
This code has very few interesting notes on how it functions: In the function: “discolight” we use a randomizer to set every pixel to some random rgb value. In the function:
|
||||
<strong>police</strong> we use a simpole calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take
|
||||
turns in who gets to light up first, creating a policelight effect.</p>
|
||||
<p>The Exams</p>
|
||||
<p>I’ll tell you straight up i failed the exams almost thrice due to a mixture of circumstance, lack of cricital knowledge, tunnel vision and as it’s called in my own generation’s
|
||||
words; <em>an issue of the skill</em> or <em>skill issue</em>. Since i generally find the fault with myself i tend to agree with the latter reason even if one exam was actually scuffed.</p>
|
||||
<p>The exams revolved around being able to fetch data from a website, filter this data out to only show the data you want such as the latest uploaded temperature and wind direction.
|
||||
This data would be printed and the leds would be programmed to respond to the data with different collors (cold = 1-15 blue, hot 1-15 red stuff like that). The time given for this
|
||||
was about 3 days to figure out and turn into an essay with some proof. Now i knew my leds better than i knew everything else which was exactly the problem the first time,
|
||||
I could not figure out how to filter data and this caused me to crash with the grace of a piece of satelite space debris.</p>
|
||||
<p>The second time i did an exam i was with one other guy. This time i actually had a decent idea of what i was supposed to do but there was a minor ever so slight inconvenience:
|
||||
The data you were supposed to collect was set up with a mqtt connection through a ssl connection. Now for context when i figured out this problem at the end of the 2nd day (roughly
|
||||
16-24 hours of work in). The ssl certificate system (in hindsight was a simple fix) was never mentioned or provided in the readers which caused me great annoyance. If it looks
|
||||
bad right now don’t worry it gets worse. I mailed my teacher about it who neither knew nor cared about the issue at the time so i tried to just make things work by generating
|
||||
data myself and working out every solution i could.</p>
|
||||
<p>Whilst doing all of this i learned a lot more about python and found out i’m very easily electrically charged. Yeah AD study’s are something sometimes, just not a good something.</p>
|
||||
<p>So i mentioned it would get worse and a random guy, now i made an essay with proof and an unhealthy dosis of “office passive aggression” to which I was asked and i quote: “How do
|
||||
you put so much malevolence and hatred in an essay?”. Well i showed up hoping my extensive work would at least get me a pass on the subject, I was wrong: My teacher said that due
|
||||
asking the AI to generate data to test my code he couldn’t trust my work even though i could not collect the data myself, to add insult to injury he blatanly ignored his connection
|
||||
mishap pulling the bureacratic move called “pleading oopsie daisy” and “It’s a hbo study you should figure it out yourself bozo”. To top it off the other guy had sent nothing
|
||||
in stating “if it didn’t work he couldn’t send it” and gave up early on. So to sum it up i spent 3 days debugging something unsolvable at the time and got another shot for my trouble,
|
||||
the other guy also got another shot for doing absolutely nothing. So the teacher would send another exam (3rd) later that week where he’d solve the connection part to ensure there was
|
||||
no faulty information or code on our side. Now i knew the other guy was notorious for using AI from which i restrain so my frustration was immense and understandable at this point. Since
|
||||
i got told to my face that my effort didn’t matter in the slightest I opted to bureacraticly engage my teacher to a breaking point from that point on to ensure he would not pull any shenanigans
|
||||
like this again. (I continue this practice to this day.)</p>
|
||||
<p>The third exam i did pass a week later and it felt hollow as a dead piece of bark. The code i wrote changed quite a lot since i copied from github and AI alike if i didn’t understand something
|
||||
since at this point i didn’t really give a hoot whether my code was or looked authentic since i got memed on by my teachers so I decided to return similar effort. This marks the beginning of
|
||||
the time where i stopped caring about how i got my code provided it worked first.</p>
|
||||
<p>Much like how I started my code i divided everything up in functions but did throw at intergers into a singular file since at this point i did not care anymore. To quickly summarize everything;
|
||||
The code is given all functions to connect to the local wifi and to the mqtt broker afterwards. The last exam did not care for the ledstrip and just wanted to see a led output so it
|
||||
has a place alongside the print lines to show if the water was rising or falling. One of the tasks was to write the data of every hour or so to a csv file, for this I used the time of the
|
||||
watermeter against itself since it only updated every 10-15 minutes and made the pico write the data down every 5th time. I will say that the tricks employed in this code are interesting
|
||||
since it has a heavy focus on just being lazy but efficient which is a programmer’s quota.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">time</span>
|
||||
<span class="kn">import</span> <span class="nn">network</span>
|
||||
<span class="kn">from</span> <span class="nn">machine</span> <span class="kn">import</span> <span class="n">Pin</span>
|
||||
<span class="kn">from</span> <span class="nn">simple</span> <span class="kn">import</span> <span class="n">MQTTClient</span>
|
||||
<span class="c1"># import csv #i can't figure out why yet but csv disables the whole script</span>
|
||||
|
||||
<span class="n">wlan</span> <span class="o">=</span> <span class="n">network</span><span class="o">.</span><span class="n">WLAN</span><span class="p">(</span><span class="n">network</span><span class="o">.</span><span class="n">STA_IF</span><span class="p">)</span>
|
||||
<span class="n">wlan</span><span class="o">.</span><span class="n">active</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">wlan</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">"ssid"</span><span class="p">,</span><span class="s2">"ssidpwd"</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ledup</span> <span class="o">=</span> <span class="n">Pin</span><span class="p">(</span><span class="mi">16</span><span class="p">,</span> <span class="n">Pin</span><span class="o">.</span><span class="n">OUT</span><span class="p">)</span>
|
||||
<span class="n">leddown</span> <span class="o">=</span> <span class="n">Pin</span><span class="p">(</span><span class="mi">17</span><span class="p">,</span> <span class="n">Pin</span><span class="o">.</span><span class="n">OUT</span><span class="p">)</span>
|
||||
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="n">wlan</span><span class="o">.</span><span class="n">isconnected</span><span class="p">())</span>
|
||||
|
||||
<span class="c1"># Use the correct MQTT server address and topic</span>
|
||||
<span class="n">mqtt_server</span> <span class="o">=</span> <span class="s1">'825c912987534f048c3fbc28bb6ad943.s2.eu.hivemq.cloud'</span>
|
||||
<span class="n">topic_sub</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">'waterstand'</span>
|
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">sub_cb</span><span class="p">(</span><span class="n">topic</span><span class="p">,</span> <span class="n">msg</span><span class="p">):</span>
|
||||
<span class="k">global</span> <span class="n">preval</span><span class="p">,</span> <span class="n">counter</span> <span class="c1">#create all variables used to avoid undefined errors</span>
|
||||
<span class="n">topic_str</span> <span class="o">=</span> <span class="n">topic</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> <span class="c1"># remove unwanted characters using the strip() method https://www.w3schools.com/python/ref_string_strip.asp</span>
|
||||
<span class="c1"># remove unwanted characters using the strip() method</span>
|
||||
<span class="n">msg_str</span> <span class="o">=</span> <span class="n">msg</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"New message on topic </span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">topic_str</span><span class="p">))</span>
|
||||
<span class="c1"># value = msg_str[-4:].replace(';', '') # this is the first method i used to ensure if the leds function worked, this however had problems with slicing giving me characters back which crashed the program</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Received Data: Topic = </span><span class="si">{</span><span class="n">topic_str</span><span class="si">}</span><span class="s2">, Msg = </span><span class="si">{</span><span class="n">msg_str</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="c1"># get the last item of the resulting list sorted by ;</span>
|
||||
<span class="n">value</span> <span class="o">=</span> <span class="n">msg_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">";"</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"Value: "</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
|
||||
<span class="n">newval</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">newval</span> <span class="o">!=</span> <span class="n">preval</span><span class="p">:</span> <span class="c1"># compare new value with previous value</span>
|
||||
<span class="k">if</span> <span class="n">newval</span> <span class="o">></span> <span class="n">preval</span><span class="p">:</span>
|
||||
<span class="n">ledup</span><span class="o">.</span><span class="n">on</span><span class="p">()</span>
|
||||
<span class="n">leddown</span><span class="o">.</span><span class="n">off</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"value going up"</span><span class="p">)</span>
|
||||
<span class="k">elif</span> <span class="n">newval</span> <span class="o"><</span> <span class="n">preval</span><span class="p">:</span>
|
||||
<span class="n">leddown</span><span class="o">.</span><span class="n">on</span><span class="p">()</span>
|
||||
<span class="n">ledup</span><span class="o">.</span><span class="n">off</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"value going down"</span><span class="p">)</span>
|
||||
<span class="n">preval</span> <span class="o">=</span> <span class="n">newval</span> <span class="c1"># update previous value</span>
|
||||
|
||||
<span class="n">counter</span> <span class="o">+=</span> <span class="mi">1</span>
|
||||
<span class="k">if</span> <span class="n">counter</span> <span class="o">==</span> <span class="mi">4</span><span class="p">:</span>
|
||||
<span class="n">csvfile2</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data.csv"</span><span class="p">,</span> <span class="s2">"a"</span><span class="p">)</span> <span class="c1">#turns out write overwrites the entire file and i'm just a moron</span>
|
||||
<span class="c1"># to ensure this works i'm using the stripped string version so no b or /n but ; stays</span>
|
||||
<span class="n">csvfile2</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg_str</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">';'</span><span class="p">,</span> <span class="s1">','</span><span class="p">)</span> <span class="o">+</span> <span class="s2">","</span><span class="p">)</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Data written to CSV file'</span><span class="p">)</span>
|
||||
<span class="c1"># Reset counter</span>
|
||||
<span class="n">counter</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
<span class="c1"># data = [] #initially i thought i needed a list and to call or clear the last function every time</span>
|
||||
<span class="c1"># # # hoe kom je van de b" en de \n af? zoek dat op.</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">connectMQTT</span><span class="p">():</span>
|
||||
<span class="n">client</span> <span class="o">=</span> <span class="n">MQTTClient</span><span class="p">(</span><span class="n">client_id</span><span class="o">=</span><span class="sa">b</span><span class="s1">'1061348'</span><span class="p">,</span>
|
||||
<span class="n">server</span><span class="o">=</span><span class="n">mqtt_server</span><span class="p">,</span>
|
||||
<span class="n">port</span><span class="o">=</span><span class="mi">8883</span><span class="p">,</span>
|
||||
<span class="n">user</span><span class="o">=</span><span class="sa">b</span><span class="s2">"racdata"</span><span class="p">,</span>
|
||||
<span class="n">password</span><span class="o">=</span><span class="sa">b</span><span class="s2">"herkansingpython2"</span><span class="p">,</span>
|
||||
<span class="n">keepalive</span><span class="o">=</span><span class="mi">7200</span><span class="p">,</span>
|
||||
<span class="n">ssl</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">ssl_params</span><span class="o">=</span><span class="p">{</span><span class="s1">'server_hostname'</span><span class="p">:</span> <span class="n">mqtt_server</span><span class="p">}</span>
|
||||
<span class="p">)</span>
|
||||
<span class="n">client</span><span class="o">.</span><span class="n">set_callback</span><span class="p">(</span><span class="n">sub_cb</span><span class="p">)</span>
|
||||
<span class="n">client</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Connected to </span><span class="si">%s</span><span class="s1"> MQTT Broker'</span> <span class="o">%</span> <span class="p">(</span><span class="n">mqtt_server</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">client</span>
|
||||
|
||||
<span class="c1"># If failed to connect to the MQTT broker, reset the machine</span>
|
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">reconnect</span><span class="p">():</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s1">'Failed to connect to MQTT Broker. Reconnecting...'</span><span class="p">)</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="n">machine</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
|
||||
|
||||
|
||||
<span class="c1"># Try to connect to the MQTT broker, if failed, reconnect</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">client</span> <span class="o">=</span> <span class="n">connectMQTT</span><span class="p">()</span>
|
||||
<span class="k">except</span> <span class="ne">OSError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">reconnect</span><span class="p">()</span>
|
||||
|
||||
<span class="n">preval</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># old first value</span>
|
||||
<span class="n">counter</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># Initialize the counter</span>
|
||||
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="c1"># ledup.on()</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="c1"># ledup.off()</span>
|
||||
<span class="n">client</span><span class="o">.</span><span class="n">subscribe</span><span class="p">(</span><span class="n">topic_sub</span><span class="p">)</span> <span class="c1"># subscribe to the topic</span>
|
||||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>What you can take away from all this is that much like the modern workplace hard work does not actually pay, efficient, lazy, idiotproof and preresearched work pays. It’s not
|
||||
about how hard you try or how committed you are it’s about if it works and how good it works. The strongest sword wains when the wielder is weak so be smart and disciplined.</p>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
<p class="caption" role="heading"><span class="caption-text">2022-2023:</span></p>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html">escape-room ithamar</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="escape_room.html#code">code</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="pico.html">Arduino pico</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="P4_realiseren.html">Werkplaats Realiseren</a></li>
|
||||
</ul>
|
||||
|
93
documentation/source/J1P2/Pico/python2redo.py
Normal file
@ -0,0 +1,93 @@
|
||||
import time
|
||||
import network
|
||||
from machine import Pin
|
||||
from simple import MQTTClient
|
||||
# import csv #i can't figure out why yet but csv disables the whole script
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
wlan.connect("ssid","ssidpwd")
|
||||
|
||||
ledup = Pin(16, Pin.OUT)
|
||||
leddown = Pin(17, Pin.OUT)
|
||||
|
||||
time.sleep(5)
|
||||
print(wlan.isconnected())
|
||||
|
||||
# Use the correct MQTT server address and topic
|
||||
mqtt_server = '825c912987534f048c3fbc28bb6ad943.s2.eu.hivemq.cloud'
|
||||
topic_sub = b'waterstand'
|
||||
|
||||
|
||||
def sub_cb(topic, msg):
|
||||
global preval, counter #create all variables used to avoid undefined errors
|
||||
topic_str = topic.decode("utf-8") # remove unwanted characters using the strip() method https://www.w3schools.com/python/ref_string_strip.asp
|
||||
# remove unwanted characters using the strip() method
|
||||
msg_str = msg.decode("utf-8").strip()
|
||||
print("New message on topic {}".format(topic_str))
|
||||
# value = msg_str[-4:].replace(';', '') # this is the first method i used to ensure if the leds function worked, this however had problems with slicing giving me characters back which crashed the program
|
||||
print(f"Received Data: Topic = {topic_str}, Msg = {msg_str}")
|
||||
# get the last item of the resulting list sorted by ;
|
||||
value = msg_str.split(";")[-1]
|
||||
print("Value: ", value)
|
||||
newval = int(value)
|
||||
if newval != preval: # compare new value with previous value
|
||||
if newval > preval:
|
||||
ledup.on()
|
||||
leddown.off()
|
||||
print("value going up")
|
||||
elif newval < preval:
|
||||
leddown.on()
|
||||
ledup.off()
|
||||
print("value going down")
|
||||
preval = newval # update previous value
|
||||
|
||||
counter += 1
|
||||
if counter == 4:
|
||||
csvfile2 = open("data.csv", "a") #turns out write overwrites the entire file and i'm just a moron
|
||||
# to ensure this works i'm using the stripped string version so no b or /n but ; stays
|
||||
csvfile2.write(str(msg_str).replace(';', ',') + ",")
|
||||
print('Data written to CSV file')
|
||||
# Reset counter
|
||||
counter = 0
|
||||
# data = [] #initially i thought i needed a list and to call or clear the last function every time
|
||||
# # # hoe kom je van de b" en de \n af? zoek dat op.
|
||||
|
||||
def connectMQTT():
|
||||
client = MQTTClient(client_id=b'1061348',
|
||||
server=mqtt_server,
|
||||
port=8883,
|
||||
user=b"racdata",
|
||||
password=b"herkansingpython2",
|
||||
keepalive=7200,
|
||||
ssl=True,
|
||||
ssl_params={'server_hostname': mqtt_server}
|
||||
)
|
||||
client.set_callback(sub_cb)
|
||||
client.connect()
|
||||
print('Connected to %s MQTT Broker' % (mqtt_server))
|
||||
return client
|
||||
|
||||
# If failed to connect to the MQTT broker, reset the machine
|
||||
|
||||
|
||||
def reconnect():
|
||||
print('Failed to connect to MQTT Broker. Reconnecting...')
|
||||
time.sleep(5)
|
||||
machine.reset()
|
||||
|
||||
|
||||
# Try to connect to the MQTT broker, if failed, reconnect
|
||||
try:
|
||||
client = connectMQTT()
|
||||
except OSError as e:
|
||||
reconnect()
|
||||
|
||||
preval = 0 # old first value
|
||||
counter = 0 # Initialize the counter
|
||||
while True:
|
||||
# ledup.on()
|
||||
time.sleep(5)
|
||||
# ledup.off()
|
||||
client.subscribe(topic_sub) # subscribe to the topic
|
||||
time.sleep(1)
|
@ -21,7 +21,7 @@ Voor de metingen nam ik de moeite de meet locatie te verkennen en uit te beelden
|
||||
meetappartuur vroegtijdig aangeven. Verder zocht ik (tervegeefs) contact met de aandeelhouders maar dit werdt later door een leraar verholpen sinds alle groepjes hier problemen
|
||||
mee hadden.
|
||||
|
||||
.. image:: werkplaats_realiseren/diagram period 3.png
|
||||
.. image:: werkplaats_realiseren/diagramperiod3.png
|
||||
|
||||
Voor deze periode had ik een prototype bedacht dat om de gebruikers te meten aan de hand van bluetooth signalen in een 5-10 meter radius dat gebruik maakte van het slechte
|
||||
signaal in de toiletten en wat positionering. Voor dit prototype dacht ik eerst de hc-05 bluetooth module voor te gebruiken maar ik had voor de veiligheid 2 esp32 firebeetle
|
||||
|
@ -2,26 +2,18 @@
|
||||
Stage/Internship
|
||||
****************
|
||||
|
||||
Voor Jaar 2 Periode 2 moeten de studenten een stage vinden en lopen. De eerste stage is een meewerkstage waar de student moet leren in een werkomgeving te presteren en een idee
|
||||
te krijgen over hun werk in de praktijk. De "tweede" stage is een afstudeerstage die vanaf periode 3 tot 4 duurt waarbij de student een afstudeeropdracht moet maken bij het
|
||||
bedrijf waar ze stage lopen. De stages mogen en kunnen bij een bedrijf worden uitgevoerd maar de student wordt verwacht zelf contact te leggen met een bedrijf en een stage te
|
||||
regelen.
|
||||
Voor Jaar 2 Periode 2 moeten de studenten een stage vinden. Dit traject is verdeeld in twee stages waar de student wordt getoetst op alles wat hij/zij heeft geleerd in de studie
|
||||
en moet uiteindelijk op basis van deze stage slagen voor de opleiding. De stage is officieel verdeeld in twee stages maar kan op een adres worden gelopen mits het bedrijf de
|
||||
student kan begeleiden op basis van de studie.
|
||||
|
||||
meewerkstage
|
||||
------------
|
||||
|
||||
De meewerkstage is de warmup van hoe het jaar er uit gaat zien voor de studenten en zoals met de meeste opdrachten die de studenten hebben gedaan in het vorige jaar is dit het
|
||||
"makkelijke" deel voordat net zoals met andere vakken de volgende opdracht een veel uitdagendere variant is van dezelfde opdracht. Een simpel voorbeeld hiervan is jaar 2 periode 1:
|
||||
In deze periode moet de student laten zien dat hij een stage kan bemachtigen, enkel dit voor een vak. Nu voor periode 2 moet de student bij deze stageplek meelopen op de werkvloer.
|
||||
Periode 3-4 zijn gelijk geclusterd en vragen (als de student geen geschikte stageplek heeft gekozen) het process van periode 1 en 2 opnieuw uit te voeren en daarbij ook op eigen
|
||||
initiatief een afstudeeropdracht te bedenken, uit te voeren door meerdere vakken te herhalen zoals de werkplaats en User Experience in een kwestie van 2 periodes met een tijdslimiet.
|
||||
|
||||
De eerste stage: dit wordt toegevoegd zodra ik een stage heb
|
||||
De meewerkstage is bedoeld om studenten ervaring te laten op doen op de werkvloer als een echte baan. Deze stage duurt voor de gehele duratie van waar de student stage loopt
|
||||
en tijdens deze stage wordt er verwacht dat de student meedraait als een reguliere werknemer in het bedrijf. Wat wel van belang is tijdens deze stage is het zoeken naar een
|
||||
afstudeercasus om de afstudeerstage te kunnen starten in de 3e periode van het studiejaar.
|
||||
|
||||
Afstudeerstage
|
||||
--------------
|
||||
|
||||
De afstudeerstage is zoals voorheen benoemd 3-4 vakken in een blender gedeponeerd, gemixt met aceton en geinjecteerd met steroids: De student moet als hij geen gepaste stage had
|
||||
in periode 2 een nieuwe stage vinden en in het bedrijf meedraaien terwijl de student ook een afstudeeropdracht moet bedenken waarbij de student een verbetering/contributie voor
|
||||
het bedrijf moet bedenken, ontwerpen en bouwen tot een prototype. Dit is ook praktisch de finale opdracht van de studie waar de student alles wat ze hebben geleerd moeten
|
||||
gebruiken om te laten zien das ze HBO en IoT materiaal zijn.
|
||||
Voor de afstudeerstage moet de student een casus vinden binnen het bedrijf dat de student mogelijk kan oplossen met IoT.
|
@ -4,23 +4,17 @@ Ithamar's Agenda
|
||||
Tabel van opdrachten
|
||||
|
||||
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Wat | Wanneer | Opmerking | Status |
|
||||
+=============================+=================================+==================================================+========+
|
||||
|| || || || |
|
||||
|| || || || |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| HerExamen 2 SQLite | ????? | lees dit keer iets meer door | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Nederlands her-Examen 3 | ???? | | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Stage + opdracht | januari | moet voor periode 3 januri geregeld zijn | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Afstudeerstage + opdracht | 20 januari | vereist voor het cijfer van SQLite | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Keuzevak voor jaar 2 | 2023-2024 | opmaak voor gefaald zorgrobot, japans misschien? | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Haal firebeetle op van paul | 4 september 2023 - 28 juli 2024 | uitleensel | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
| Fnaf movie october | 27 october | Groep/solo uitje | |
|
||||
+-----------------------------+---------------------------------+--------------------------------------------------+--------+
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Wat | Wanneer | Opmerking | Status |
|
||||
+====================+============+===================+=========+
|
||||
|| || || || |
|
||||
|| || || || |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Krane impact | 01/07/2024 | Fall Ost | Ongoing |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| internship essay | september | initial defeat | Ongoing |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Workplace Research | ??? | Last man standing | tbd |
|
||||
+--------------------+------------+-------------------+---------+
|
||||
| Zenoh casus | ??? | initiative | tbd |
|
||||
+--------------------+------------+-------------------+---------+
|
@ -35,21 +35,36 @@ Cijferlijst
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| studieloopbaancoaching 1 | Voldoende | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Data | 9.0 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| RSP | 8.5 | 4 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| UX | 5.5 | 4 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Ethiek | 8.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Cisco Intergraal | 8.8 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Data | 9.0 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| Design research | 8.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| slc final assesment | 7.0 | 5 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| State of the art 1 | 9.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
| State of the art 2 | 9.5 | 2 studiepunten | |
|
||||
+--------------------------+-----------+----------------+----------+
|
||||
|
||||
************
|
||||
herkansingen
|
||||
************
|
||||
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| Vak | Cijfer | studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| User Experience | 5.2 | 4 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| SQLite | 4.2 | 2 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| zorgrobot | 5.0 | 2 studiepunten | Keuzevak (niet voor herhaling vatbaar) |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| OP2 studieloopbaancoaching | Onvoldoende | 2 studiepunten | Forgor thrice, couldn't redo b4 new year |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
| Nederlands | 5.3 | 2 studiepunten | |
|
||||
+----------------------------+-------------+----------------+------------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
| Vak | Cijfer | studiepunten | |
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
| | | | |
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
||||
+-----------------+--------+----------------+----------------------------------------+
|
@ -3,36 +3,43 @@ escape-room ithamar
|
||||
*******************
|
||||
Documentatie voor ithamar's escaperoom.
|
||||
|
||||
Voor jaar 1 periode 2 van mijn studie IoT moet ik een escaperoom maken met een arduino in een groepje. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de werkplaats arduino.
|
||||
Voor jaar 1 periode 2 van de studie Internet of Things moeten de studenten in een groepje een escaperoom maken met arduino's. deze escaperoom
|
||||
moet gemaakt worden via de kennis die is opgedaan met de opdrachten van de periode bij het vak 'werkplaats arduino' om creativiteit en affiniteit te demonstreren binnen het vak.
|
||||
|
||||
Het groepje waarbij ik zit heeft als thema: horror, ondanks dit thema is de echte horror een doos vinden om de escaperoom uit te maken
|
||||
en op tijd de puzzles te maken en te kunnen verwerken in deze doos.
|
||||
Het groepje waarbij ik zat heeft als thema: horror, het denkproces achter dit thema is om een authentieke escaperoom te imiteren door de puzzels op een logische manier op elkaar te laten
|
||||
aansluiten. Het concept achter de escaperoom was om een doos te bouwen uit plywood en de 4 horizontale zijdes te gebruiken om de puzzels in te bouwen en zo klokwijs op elkaar aan te sluiten.
|
||||
|
||||
De puzzel die ik wil maken is afgeleid van de `oneshot color puzzle <https://www.youtube.com/watch?v=VaPQGiTq8Bc>`_
|
||||
De puzzel die ik heb gemaakt is afgeleid van de `oneshot color puzzle <https://www.youtube.com/watch?v=VaPQGiTq8Bc>`_ van de 2014 console game 'oneshot'. Bij deze puzzel moet de speler aan de hand
|
||||
van 5 knoppen de juiste kleur op eenp positie krijgen zonder te weten in welke volgorde deze moet.
|
||||
|
||||
.. image:: escape_room/design.png
|
||||
|
||||
Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, maar om kabels te besparen zullen we dit vervangen met leds van een
|
||||
WS2812B. Hiervoor is een simpele sketch gemaakt om vanaf te werken.
|
||||
|
||||
.. image:: escape_room/nwsketch.png
|
||||
|
||||
8 december: de puzzel is fysiek compleet maar moet nog geprogrammeerd worden en de bekabeling gecontroleerd, zodra dit gedeelte klaar is zijn er
|
||||
nog 2 mogelijke problemen met het gehele project: de puzzel naar puzzel communicatie en de intergratie van in de escapedoos.
|
||||
Bij de eerste sketch waren RGB leds gekozen om de lampjes te representeren, om ruimte en praktische redenen werden de lampjes later vervangen met led-strips om bekabeling en troubleshooting
|
||||
een simpler process te maken. Dit liet ook toe dat de hele puzzel op een breakboard kon worden gesoldeerd voor een meer robust resultaat om goed in hout te kunnen worden gezet.
|
||||
|
||||
.. image:: escape_room/nanobuild.jpg
|
||||
.. image:: escape-room/oneshot_illustration.png
|
||||
|
||||
11 december: De puzzel is nog in productie maar het finale product is besloten, om het concept van de puzzel over te brengen heb ik ook een flowchart
|
||||
gemaakt om het process uit te leggen
|
||||
****
|
||||
code
|
||||
****
|
||||
|
||||
De code van dit prototype was geschreven in arduino/C++. Om de context van de code goed te begrijpen moet het spel ook begrepen worden: wanneer de puzzel opstart wordt er een willekeurige code
|
||||
gegenereerd van 5 cijfers tussen 1 en 5. Elk cijfer staat paralel met een kleur van led strips. Wanneer de gebruiker op de 6e knop drukt om de kleurcode te controleren krijgt deze feedback over
|
||||
hoeveel kleuren er correct zijn maar niet welke. De gebruiker kan dus alleen uitmaken welke kleur er correct is door af te leiden of er meer of minder correcte antwoorden zijn op basis van de feedback.
|
||||
Voor de gebruiker wordt de code dus een kwestie vane de kleuren blijven aanpassen op basis van welke score deze krijgt net zoals het raden van een cijfercombinatie van een slot.
|
||||
|
||||
De led-strips worden indvidueel aangestuurd door de knoppen. Elke keer dat de konp word ingedrukt wordt een waarde van de knop aangepast om overeen te komen met een kleur. Denk dus rood 1, groen 2 etc.
|
||||
.. image:: escape-room/oneshot_ledset.png
|
||||
|
||||
De waardes van de voorgenoemde led-strips worden hergebruikt voor het spel: De code die gegenereerd wordt heeft een vaste positie in een array. Als de gebruiker een lichtje veranderd via de knoppen dan wordt
|
||||
achter de schermen door de gebruiker een eigen code gebouwd met de waardes van de lichtjes. dus denk een combinatie van groen, geel, blauw en rood als 3, 4, 1 en 5. Wanneer de gebruiker de code controleerd word
|
||||
de array van de puzzel vergeleken met de array van de gebruiker. voor elk deel van de array's die niet overkomen word een fout waarde opgeteld, op basis van deze waarde krijgt de gebruiker te zien hoeveel er fout en goed waren.
|
||||
.. image:: escape-room/oneshot_arraycheck.png
|
||||
|
||||
.. image:: escape_room/oneshot_pwdgen.png
|
||||
|
||||
.. image:: escape_room/flowchart.png
|
||||
|
||||
27 januari: De puzzel is in hout gezet voor de presentatie, helaas was bij de decoratie de opbouw van de puzzel niet in consideratie genomen. Hierdoor is de originele
|
||||
decoratie niet gebruikt in het eindproduct. Dezelfde dag zijn de puzzels samen gezet in een doos en gepresenteerd met succes. Het project werd gecijferd over de hele groep maar
|
||||
ik kan met zekerheid zeggen dat mijn onderdeel van het project genoeg heeft toegevoegd om het finale resultaat acceptabel te maken. Op het moment dat ik mijn onderdeel
|
||||
finaliseerde besloot ik geen kansen te nemen en voegde ik instructies toe om feedback te verwerken in het project voor het geval het project erg schrijnend werd.
|
||||
|
||||
|
||||
Toen alles gezegd en gedaan was kwam er een groepscijfer uit van 6.1; normaal zou dit een middelmatig/onverschillig resultaat zijn maar sinds dit een herkansing,
|
||||
groepscijfer en het vak 4 studiepunten waard was nam ik het graag aan met gratie.
|
BIN
documentation/source/escape_room/oneshot_arraycheck.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
documentation/source/escape_room/oneshot_illustration.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
documentation/source/escape_room/oneshot_ledset.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
documentation/source/escape_room/oneshot_pwdgen.png
Normal file
After Width: | Height: | Size: 28 KiB |
@ -9,34 +9,195 @@ learning to work with loops and statements. Through these projects we will be re
|
||||
The files refferenced can be found in https://git.herreweb.nl/IthamarHerrewijnen/Ithamar_code/src/branch/main/documentation/source or the git repository.
|
||||
Apart from micropython no other packages have to be installed.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from discolight_sl import *
|
||||
|
||||
# DiscoLed()
|
||||
police()
|
||||
# shutoff()
|
||||
# Riveting stuff i know
|
||||
|
||||
|
||||
|
||||
|
||||
What i did for this period code-wise is simply write a new function or script everytime i needed something, from there i'd just call said function in an adequetly named "main"
|
||||
file to test the function live. To this extent i only made a few files/functions to accomodate this class subject listed below:
|
||||
|
||||
- Main.py: As the name suggests this file's only purpose (as shown above) is to call upon a function from another file.
|
||||
- Colorwave: This file is used to define color to send to a ledstrip. This file is also equipped to test a led strip if the file is run as main.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from neopixel import Neopixel
|
||||
|
||||
def hello_world():
|
||||
print("Hello")
|
||||
numpix = 30
|
||||
strip = Neopixel(numpix, 0, 28, "GRB")
|
||||
# strip = Neopixel(numpsix, 0, 0, "GRBW")
|
||||
|
||||
Notable files
|
||||
red = (255, 0, 0)
|
||||
orange = (255, 50, 0)
|
||||
yellow = (255, 100, 0)
|
||||
green = (0, 255, 0)
|
||||
blue = (0, 0, 255)
|
||||
indigo = (100, 0, 90)
|
||||
violet = (200, 0, 100)
|
||||
colors_rgb = [red, orange, yellow, green, blue, indigo, violet]
|
||||
|
||||
Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not.
|
||||
while True:
|
||||
strip.rotate_right(1)
|
||||
time.sleep(0.15)
|
||||
strip.show()
|
||||
|
||||
.. collapse:: Notes
|
||||
Trivia
|
||||
|
||||
This code contains a lot of callable intergers, it also gives the function to the ledstrip to move from left to right.
|
||||
Colorwave: This is one of the files required to work with the ledstrip. It defines colors for easier use and can be used as a test file to see if a strip works or not. This code
|
||||
contains a lot of callable intergers to be used as a reference sheet to avoid clutter in the main code, it also gives the function to the ledstrip to move from left to right.
|
||||
|
||||
NeoPixel: this file actually programs directly into the ledstrip rather than give it some intergers. This file is required to operate the ledstrip to begin with.
|
||||
therefore it is a rather large file with a full documentation on `github <https://github.com/adafruit/Adafruit_NeoPixel>`_.
|
||||
|
||||
.. collapse:: notes
|
||||
|
||||
This code contains all the technical functions of the ledstrip setup. The interesting part for the user are functinos such as "brightness", "show" and "rotate". Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the fun functions to create your own custom lighting.
|
||||
therefore it is a rather large file (text wise) with a full documentation on `github <https://github.com/adafruit/Adafruit_NeoPixel>`.
|
||||
This code contains all the technical functions of the ledstrip script. The interesting part for the user are functions such as **brightness**, **show** and **rotate**. Whereas
|
||||
colorwave gave the user the colors for the ledstrip, Neopixel gives the user all the *fun* functions to create your own custom lighting.
|
||||
|
||||
discolight_sl: This is the main file i'm currently using to stash all my functions in. For the moment this only includes some code i got from some `guy <https://git.herreweb.nl/EljakimHerrewijnen>`_
|
||||
called disco. My own code which is called police and a shutoff function. Because i'm too lazy to scroll for the functions i call them in a different file.
|
||||
|
||||
.. collapse:: Notes
|
||||
This code has very few interesting notes on how it functions: In the function: "discolight" we use a randomizer to set every pixel to some random rgb value. In the function:
|
||||
**police** we use a simpole calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take
|
||||
turns in who gets to light up first, creating a policelight effect.
|
||||
|
||||
This code has very few interesting notes, In the function: "discolight" we use a randomizer to set every pixel to some random rgb value. In the function :"police"
|
||||
we use a clever calculation to get the even numbers for one set of leds and the very same formula to get the uneven leds. After that we simply make the leds take turns
|
||||
in who gets to light up first, creating a policelight effect.
|
||||
The Exams
|
||||
|
||||
This code is a work in progress and will be continued in due time.
|
||||
I'll tell you straight up i failed the exams almost thrice due to a mixture of circumstance, lack of cricital knowledge, tunnel vision and as it's called in my own generation's
|
||||
words; *an issue of the skill* or *skill issue*. Since i generally find the fault with myself i tend to agree with the latter reason even if one exam was actually scuffed.
|
||||
|
||||
The exams revolved around being able to fetch data from a website, filter this data out to only show the data you want such as the latest uploaded temperature and wind direction.
|
||||
This data would be printed and the leds would be programmed to respond to the data with different collors (cold = 1-15 blue, hot 1-15 red stuff like that). The time given for this
|
||||
was about 3 days to figure out and turn into an essay with some proof. Now i knew my leds better than i knew everything else which was exactly the problem the first time,
|
||||
I could not figure out how to filter data and this caused me to crash with the grace of a piece of satelite space debris.
|
||||
|
||||
The second time i did an exam i was with one other guy. This time i actually had a decent idea of what i was supposed to do but there was a minor ever so slight inconvenience:
|
||||
The data you were supposed to collect was set up with a mqtt connection through a ssl connection. Now for context when i figured out this problem at the end of the 2nd day (roughly
|
||||
16-24 hours of work in). The ssl certificate system (in hindsight was a simple fix) was never mentioned or provided in the readers which caused me great annoyance. If it looks
|
||||
bad right now don't worry it gets worse. I mailed my teacher about it who neither knew nor cared about the issue at the time so i tried to just make things work by generating
|
||||
data myself and working out every solution i could.
|
||||
|
||||
Whilst doing all of this i learned a lot more about python and found out i'm very easily electrically charged. Yeah AD study's are something sometimes, just not a good something.
|
||||
|
||||
So i mentioned it would get worse and a random guy, now i made an essay with proof and an unhealthy dosis of "office passive aggression" to which I was asked and i quote: "How do
|
||||
you put so much malevolence and hatred in an essay?". Well i showed up hoping my extensive work would at least get me a pass on the subject, I was wrong: My teacher said that due
|
||||
asking the AI to generate data to test my code he couldn't trust my work even though i could not collect the data myself, to add insult to injury he blatanly ignored his connection
|
||||
mishap pulling the bureacratic move called "pleading oopsie daisy" and "It's a hbo study you should figure it out yourself bozo". To top it off the other guy had sent nothing
|
||||
in stating "if it didn't work he couldn't send it" and gave up early on. So to sum it up i spent 3 days debugging something unsolvable at the time and got another shot for my trouble,
|
||||
the other guy also got another shot for doing absolutely nothing. So the teacher would send another exam (3rd) later that week where he'd solve the connection part to ensure there was
|
||||
no faulty information or code on our side. Now i knew the other guy was notorious for using AI from which i restrain so my frustration was immense and understandable at this point. Since
|
||||
i got told to my face that my effort didn't matter in the slightest I opted to bureacraticly engage my teacher to a breaking point from that point on to ensure he would not pull any shenanigans
|
||||
like this again. (I continue this practice to this day.)
|
||||
|
||||
The third exam i did pass a week later and it felt hollow as a dead piece of bark. The code i wrote changed quite a lot since i copied from github and AI alike if i didn't understand something
|
||||
since at this point i didn't really give a hoot whether my code was or looked authentic since i got memed on by my teachers so I decided to return similar effort. This marks the beginning of
|
||||
the time where i stopped caring about how i got my code provided it worked first.
|
||||
|
||||
Much like how I started my code i divided everything up in functions but did throw at intergers into a singular file since at this point i did not care anymore. To quickly summarize everything;
|
||||
The code is given all functions to connect to the local wifi and to the mqtt broker afterwards. The last exam did not care for the ledstrip and just wanted to see a led output so it
|
||||
has a place alongside the print lines to show if the water was rising or falling. One of the tasks was to write the data of every hour or so to a csv file, for this I used the time of the
|
||||
watermeter against itself since it only updated every 10-15 minutes and made the pico write the data down every 5th time. I will say that the tricks employed in this code are interesting
|
||||
since it has a heavy focus on just being lazy but efficient which is a programmer's quota.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
import network
|
||||
from machine import Pin
|
||||
from simple import MQTTClient
|
||||
# import csv #i can't figure out why yet but csv disables the whole script
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
wlan.connect("ssid","ssidpwd")
|
||||
|
||||
ledup = Pin(16, Pin.OUT)
|
||||
leddown = Pin(17, Pin.OUT)
|
||||
|
||||
time.sleep(5)
|
||||
print(wlan.isconnected())
|
||||
|
||||
# Use the correct MQTT server address and topic
|
||||
mqtt_server = '825c912987534f048c3fbc28bb6ad943.s2.eu.hivemq.cloud'
|
||||
topic_sub = b'waterstand'
|
||||
|
||||
|
||||
def sub_cb(topic, msg):
|
||||
global preval, counter #create all variables used to avoid undefined errors
|
||||
topic_str = topic.decode("utf-8") # remove unwanted characters using the strip() method https://www.w3schools.com/python/ref_string_strip.asp
|
||||
# remove unwanted characters using the strip() method
|
||||
msg_str = msg.decode("utf-8").strip()
|
||||
print("New message on topic {}".format(topic_str))
|
||||
# value = msg_str[-4:].replace(';', '') # this is the first method i used to ensure if the leds function worked, this however had problems with slicing giving me characters back which crashed the program
|
||||
print(f"Received Data: Topic = {topic_str}, Msg = {msg_str}")
|
||||
# get the last item of the resulting list sorted by ;
|
||||
value = msg_str.split(";")[-1]
|
||||
print("Value: ", value)
|
||||
newval = int(value)
|
||||
if newval != preval: # compare new value with previous value
|
||||
if newval > preval:
|
||||
ledup.on()
|
||||
leddown.off()
|
||||
print("value going up")
|
||||
elif newval < preval:
|
||||
leddown.on()
|
||||
ledup.off()
|
||||
print("value going down")
|
||||
preval = newval # update previous value
|
||||
|
||||
counter += 1
|
||||
if counter == 4:
|
||||
csvfile2 = open("data.csv", "a") #turns out write overwrites the entire file and i'm just a moron
|
||||
# to ensure this works i'm using the stripped string version so no b or /n but ; stays
|
||||
csvfile2.write(str(msg_str).replace(';', ',') + ",")
|
||||
print('Data written to CSV file')
|
||||
# Reset counter
|
||||
counter = 0
|
||||
# data = [] #initially i thought i needed a list and to call or clear the last function every time
|
||||
# # # hoe kom je van de b" en de \n af? zoek dat op.
|
||||
|
||||
def connectMQTT():
|
||||
client = MQTTClient(client_id=b'1061348',
|
||||
server=mqtt_server,
|
||||
port=8883,
|
||||
user=b"racdata",
|
||||
password=b"herkansingpython2",
|
||||
keepalive=7200,
|
||||
ssl=True,
|
||||
ssl_params={'server_hostname': mqtt_server}
|
||||
)
|
||||
client.set_callback(sub_cb)
|
||||
client.connect()
|
||||
print('Connected to %s MQTT Broker' % (mqtt_server))
|
||||
return client
|
||||
|
||||
# If failed to connect to the MQTT broker, reset the machine
|
||||
|
||||
|
||||
def reconnect():
|
||||
print('Failed to connect to MQTT Broker. Reconnecting...')
|
||||
time.sleep(5)
|
||||
machine.reset()
|
||||
|
||||
|
||||
# Try to connect to the MQTT broker, if failed, reconnect
|
||||
try:
|
||||
client = connectMQTT()
|
||||
except OSError as e:
|
||||
reconnect()
|
||||
|
||||
preval = 0 # old first value
|
||||
counter = 0 # Initialize the counter
|
||||
while True:
|
||||
# ledup.on()
|
||||
time.sleep(5)
|
||||
# ledup.off()
|
||||
client.subscribe(topic_sub) # subscribe to the topic
|
||||
time.sleep(1)
|
||||
|
||||
What you can take away from all this is that much like the modern workplace hard work does not actually pay, efficient, lazy, idiotproof and preresearched work pays. It's not
|
||||
about how hard you try or how committed you are it's about if it works and how good it works. The strongest sword wains when the wielder is weak so be smart and disciplined.
|
BIN
documentation/source/werkplaats_realiseren/diagramperiod3.png
Normal file
After Width: | Height: | Size: 45 KiB |