-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
894 lines (806 loc) · 42.7 KB
/
Copy pathindex.html
File metadata and controls
894 lines (806 loc) · 42.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Micro:bit Inchworm Assembly Workshop Guide">
<title>Micro:bit Inchworm Workshop</title>
<!-- Kantega Design System -->
<link rel="stylesheet" href="design-system/tokens.css">
<style>
/* ===== CSS RESET & BASE STYLES ===== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
}
code, pre, .code {
font-family: var(--kantega-font-family-mono);
}
/* ===== HEADER ===== */
header {
background: var(--kantega-gradient-cool-purple-teal);
padding: var(--kantega-space-3) var(--kantega-space-5);
box-shadow: var(--kantega-shadow-md);
display: flex;
justify-content: space-between;
align-items: center;
gap: var(--kantega-space-4);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
}
.header-left {
display: flex;
align-items: center;
gap: var(--kantega-space-3);
flex: 1;
min-width: 0;
}
.header-logo {
height: auto;
width: var(--kantega-logo-min-width-screen);
flex-shrink: 0;
}
.header-title {
font-size: var(--kantega-font-size-xl);
line-height: var(--kantega-line-height-snug);
font-weight: var(--kantega-font-weight-bold);
color: var(--kantega-color-text-inverse);
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.language-toggle {
background-color: var(--kantega-color-action-primary);
color: var(--kantega-color-text-inverse);
border: var(--kantega-border-width-medium) solid var(--kantega-color-action-primary);
padding: var(--kantega-space-2) var(--kantega-space-4);
border-radius: var(--kantega-radius-none);
font-size: var(--kantega-font-size-sm);
font-weight: var(--kantega-font-weight-semibold);
cursor: pointer;
transition: all var(--kantega-duration-base) var(--kantega-easing-standard);
touch-action: manipulation;
min-height: 40px;
display: inline-flex;
align-items: center;
gap: var(--kantega-space-2);
white-space: nowrap;
flex-shrink: 0;
}
.language-toggle:hover {
background-color: var(--kantega-color-action-primary-hover);
border-color: var(--kantega-color-action-primary-hover);
transform: translateY(-2px);
}
.language-toggle:active {
transform: translateY(0) scale(0.98);
}
/* ===== BREADCRUMB ===== */
.breadcrumb {
display: none;
}
/* ===== MAIN CONTENT ===== */
main {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: var(--kantega-space-6);
overflow-y: auto;
margin-top: 60px;
margin-bottom: 60px;
}
.step-container {
display: none;
max-width: 800px;
width: 100%;
background-color: var(--kantega-color-surface);
border-radius: var(--kantega-radius-none);
box-shadow: var(--kantega-shadow-md);
padding: var(--kantega-space-8);
animation: fadeIn var(--kantega-duration-slow) var(--kantega-easing-enter);
border: var(--kantega-border-width-thin) solid var(--kantega-color-border);
text-align: center;
}
.step-container.active {
display: block;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.step-number {
color: var(--kantega-color-text-muted);
font-size: var(--kantega-font-size-xs);
font-weight: var(--kantega-font-weight-bold);
text-transform: uppercase;
letter-spacing: var(--kantega-letter-spacing-wide);
margin-bottom: var(--kantega-space-2);
font-family: var(--kantega-font-family-mono);
}
.step-title {
font-size: var(--kantega-font-size-4xl);
line-height: var(--kantega-line-height-tight);
font-weight: var(--kantega-font-weight-bold);
color: var(--kantega-color-text);
margin-bottom: var(--kantega-space-6);
}
.step-description {
font-size: var(--kantega-font-size-md);
line-height: var(--kantega-line-height-normal);
color: var(--kantega-color-text);
margin-bottom: var(--kantega-space-6);
max-width: var(--kantega-measure);
margin-left: auto;
margin-right: auto;
text-align: left;
}
.step-description ul {
margin: var(--kantega-space-4) 0;
padding-left: var(--kantega-space-6);
}
.step-description li {
margin: var(--kantega-space-2) 0;
}
.step-description code {
background-color: var(--kantega-color-purple-dark);
color: var(--kantega-color-text-inverse);
padding: var(--kantega-space-1) var(--kantega-space-2);
border-radius: var(--kantega-radius-none);
font-size: var(--kantega-font-size-sm);
font-family: var(--kantega-font-family-mono);
}
.step-description pre {
background-color: var(--kantega-color-purple-dark);
color: var(--kantega-color-text-inverse);
border: var(--kantega-border-width-thin) solid var(--kantega-color-border);
border-radius: var(--kantega-radius-none);
padding: var(--kantega-space-5);
overflow-x: auto;
margin: var(--kantega-space-4) 0;
}
.step-description pre code {
background-color: transparent;
padding: 0;
font-size: var(--kantega-font-size-sm);
line-height: var(--kantega-line-height-normal);
font-family: var(--kantega-font-family-mono);
}
.step-description a {
color: var(--kantega-color-text-accent);
text-decoration: underline;
font-weight: var(--kantega-font-weight-semibold);
}
.step-description a:hover {
color: var(--kantega-color-red);
}
.step-image {
width: 100%;
max-width: 100%;
height: auto;
border-radius: var(--kantega-radius-none);
box-shadow: var(--kantega-shadow-md);
margin: var(--kantega-space-6) auto 0;
display: block;
border: var(--kantega-border-width-thin) solid var(--kantega-color-border);
}
/* ===== NAVIGATION ===== */
nav {
background: var(--kantega-gradient-cool-purple-teal);
padding: var(--kantega-space-3) var(--kantega-space-5);
box-shadow: 0 -2px 8px rgba(39, 0, 61, 0.2);
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 100;
}
.nav-buttons {
display: flex;
justify-content: space-between;
gap: var(--kantega-space-3);
max-width: var(--kantega-container-max);
margin: 0 auto;
}
.nav-btn {
flex: 1;
max-width: 180px;
padding: var(--kantega-space-2) var(--kantega-space-4);
font-size: var(--kantega-font-size-sm);
font-weight: var(--kantega-font-weight-semibold);
border-radius: var(--kantega-radius-none);
cursor: pointer;
transition: all var(--kantega-duration-base) var(--kantega-easing-standard);
touch-action: manipulation;
min-height: 40px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--kantega-space-2);
white-space: nowrap;
}
.nav-btn:disabled {
opacity: 0.3;
cursor: not-allowed;
}
.nav-btn:not(:disabled):hover {
transform: translateY(-2px);
}
.nav-btn:not(:disabled):active {
transform: translateY(0);
}
.btn-prev {
background-color: transparent;
color: var(--kantega-color-text-inverse);
border: var(--kantega-border-width-medium) solid var(--kantega-color-text-inverse);
}
.btn-prev:not(:disabled):hover {
background-color: var(--kantega-color-text-inverse);
color: var(--kantega-color-surface-inverse);
}
.btn-next {
background-color: var(--kantega-color-action-primary);
color: var(--kantega-color-text-inverse);
border: var(--kantega-border-width-medium) solid var(--kantega-color-action-primary);
}
.btn-next:not(:disabled):hover {
background-color: var(--kantega-color-action-primary-hover);
border-color: var(--kantega-color-action-primary-hover);
}
.btn-finish {
background-color: var(--kantega-color-yellow);
color: var(--kantega-color-surface-inverse);
border: var(--kantega-border-width-medium) solid var(--kantega-color-yellow);
font-weight: var(--kantega-font-weight-bold);
}
.btn-finish:not(:disabled):hover {
background-color: var(--kantega-color-yellow-light);
border-color: var(--kantega-color-yellow-light);
}
/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
.header-title {
font-size: var(--kantega-font-size-md);
}
main {
padding: var(--kantega-space-4);
}
.step-container {
padding: var(--kantega-space-5);
}
.step-title {
font-size: var(--kantega-font-size-2xl);
}
.step-description {
font-size: var(--kantega-font-size-md);
}
}
/* ===== PRINT STYLES ===== */
@media print {
body {
background-color: var(--kantega-color-surface);
}
.breadcrumb,
nav,
.language-toggle {
display: none !important;
}
header {
background: var(--kantega-color-surface) !important;
border-bottom: var(--kantega-border-width-thick) solid var(--kantega-color-purple);
page-break-after: avoid;
}
.header-title {
color: var(--kantega-color-purple) !important;
}
.header-logo {
width: var(--kantega-logo-min-width-screen);
}
main {
padding: 0;
}
.step-container {
display: block !important;
page-break-after: always;
padding: var(--kantega-space-6) var(--kantega-space-4);
box-shadow: none;
border: var(--kantega-border-width-thin) solid var(--kantega-color-border);
margin-bottom: var(--kantega-space-4);
}
.step-container:last-child {
page-break-after: auto;
}
.step-image {
max-width: 100%;
page-break-inside: avoid;
}
.step-title::after {
break-inside: avoid;
}
@page {
margin: 2cm;
}
/* Print footer with URL */
@page {
@bottom-right {
content: url(window.location.href);
}
}
}
</style>
</head>
<body>
<!-- Header with title and language toggle -->
<header>
<div class="header-left">
<img src="design-system/assets/logo/kantega-logo-kantega-hvit.svg" alt="Kantega" class="header-logo">
<h1 class="header-title" id="main-title">Loading...</h1>
</div>
<button class="language-toggle" id="lang-toggle" aria-label="Toggle language">
<i class="fa-solid fa-globe" aria-hidden="true"></i>
<span id="lang-label">EN</span>
</button>
</header>
<!-- Breadcrumb navigation -->
<div class="breadcrumb" id="breadcrumb">
<span id="breadcrumb-text">Step 1 of 22</span>
</div>
<!-- Main content area -->
<main id="step-content">
<!-- Steps will be dynamically rendered here -->
</main>
<!-- Bottom navigation -->
<nav>
<div class="nav-buttons">
<button class="nav-btn btn-prev" id="prev-btn" aria-label="Previous step">
<i class="fa-solid fa-arrow-left" aria-hidden="true"></i>
<span id="prev-text">Previous</span>
</button>
<button class="nav-btn btn-next" id="next-btn" aria-label="Next step">
<span id="next-text">Next</span>
<i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
</button>
</div>
</nav>
<script>
// ===== CONTENT DATA =====
// TO ADD/EDIT CONTENT: Modify the steps arrays below for each language
// Each step needs: title, description, image, and alt (alt text for accessibility)
const content = {
en: {
title: "Micro:bit Inchworm Assembly Guide",
steps: [
{
title: "Equipment",
description: "Get an equipment package and check that all the basic equipment is in place:<ul><li>micro:bit board</li><li>Small battery pack</li><li>Large battery pack</li><li>USB cable</li><li>Bag with servo motor</li><li>Four crocodile clips</li></ul>",
image: "images/step-01-equipment.jpg",
alt: "All required materials laid out on a table"
},
{
title: "The Body",
description: "Cut out a cardboard disc that will become the body of the inchworm. Use the micro:bit board as a measuring guide to see how wide it needs to be. Start with it longer than you think you need - the length can be fine-tuned later.",
image: "images/step-02-body-cardboard.jpg",
alt: "Flat cardboard disc with micro:bit for size reference"
},
{
title: "Body Shape",
description: "Fold the cardboard in the middle to create the shape of the body. You can 'crease' it against the edge of a table to get a sharper fold. This will be the middle of the inchworm.",
image: "images/step-03-body-fold.jpg",
alt: "Cardboard being folded in the middle"
},
{
title: "Body Shape - Feet",
description: "Fold two smaller flaps on each end that the inchworm can 'stand' on the table with. These will be the feet. Trim the length so it becomes just right. If it's too long it might become so large that it can't walk, but if it's too short you won't have room for all the parts.",
image: "images/step-04-body-feet.jpg",
alt: "Feet flaps folded on both ends of the body"
},
{
title: "Teeth",
description: "Fold in the corners on one of the feet so it gets two 'teeth' that it can pull itself forward with.",
image: "images/step-05-front-teeth.jpg",
alt: "Front teeth created by folding corners inward"
},
{
title: "Back Legs",
description: "Cut out some flaps on the other foot and fold them so it gets 'fingers' on the back legs that it can push itself forward with. Fold them up and down alternately, as shown in the picture.",
image: "images/step-06-back-fingers.jpg",
alt: "Fingers cut and folded alternately on back legs"
},
{
title: "Attach the Micro:bit",
description: "Cut a piece of double-sided tape, or take regular tape and fold it in two so it has adhesive on both sides, and use this to attach the micro:bit board to the front of the inchworm, on the side that has teeth.",
image: "images/step-07-microbit-attached.jpg",
alt: "Micro:bit board attached to the body with tape"
},
{
title: "Attach the Servo",
description: "Find the servo motor and attach it with tape on the other side of the inchworm, where the back legs are. It must stick out toward the edge of one side, so that the small white knob sticks out on the side of the cardboard. This will be the motor that makes the inchworm move.",
image: "images/step-08-servo-attached.jpg",
alt: "Servo motor taped to the back with knob protruding"
},
{
title: "Crocodile Clips",
description: "Attach a crocodile clip to each of the three wires coming from the servo. Choose crocodile clips that have matching colors with the wires from the servo if you can - it makes the next step a bit easier. Make sure the metal parts of each clip cannot touch each other, as this will short-circuit the system. Use the rubber protection on the crocodile clips well, and wrap some tape around where they are attached for safety if needed.",
image: "images/step-09-crocodile-clips.jpg",
alt: "Crocodile clips attached to servo wires with protective tape"
},
{
title: "Connect Servo to Micro:bit",
description: "Attach the other end of each of the crocodile clips to the micro:bit. Make sure the correct wire is connected to the correct place on the micro:bit. Remember, it's the colours on the wires from the servo that are the keys, the crocodile clip cables may have different colours.<ul><li><strong>Yellow/Orange wire</strong> → Pin 0</li><li><strong>Red wire</strong> → 3V</li><li><strong>Black wire</strong> → GND</li></ul>",
image: "images/step-10-wiring-microbit.jpg",
alt: "Crocodile clips connected to micro:bit pins"
},
{
title: "Attach Metal Wire to Servo Arm",
description: "Attach a good length of metal wire to a servo arm. Bend a small hook at the end of the wire, with the short side of the hook on the 'inside' of the arm. This will be attached to the servo and should be able to rotate freely. If the short side of the hook is too long, it can wrap around the servo when it moves.",
image: "images/step-11-servo-arm-wire.jpg",
alt: "Servo arm with loose wire attached"
},
{
title: "Attach the Arm to the Inchworm",
description: "Now we'll create the 'muscles' that make the inchworm move. Attach the servo arm to the servo, and secure the other end of the metal wire firmly into the cardboard on the opposite side. A tip is to poke the wire through the cardboard and secure it with tape. Adjust the wire length so that when the servo is turned on and tilts back and forth, the inchworm gets a nice crawling motion. When this is attached, the inchworm body itself is complete!",
image: "images/step-12-arm-attached.jpg",
alt: "Servo arm and wire attached to cardboard"
},
{
title: "Connect the Inchworm to the Computer",
description: "Now it's time to tell it to do something. Attach the USB cable to the micro:bit and plug it into the computer. The micro:bit should start to light up.",
image: "images/step-13-usb-connection.jpg",
alt: "Micro:bit connected via USB cable"
},
{
title: "Open the Code Editor and Connect the Micro:bit",
description: "Open the <a href='https://makecode.microbit.org/#editor' target='_blank'>MakeCode editor</a> in your browser. Click on the three dots, select 'Connect Device', and follow the instructions to connect the micro:bit to the computer.",
image: "images/step-14-connect-device.jpg",
alt: "Screenshot of Connect Device button"
},
{
title: "Add Test Code",
description: "Build this code block in the block editor, or paste this code snippet into the JavaScript editor:<pre><code>input.onButtonPressed(Button.A, function () {\n pins.servoWritePin(AnalogPin.P0, 0)\n basic.pause(500)\n pins.servoWritePin(AnalogPin.P0, 180)\n basic.pause(500)\n})</code></pre>",
image: "images/step-15-test-code.jpg",
alt: "Screenshot of test code block"
},
{
title: "Test the Inchworm",
description: "Click the Download button and wait for the code to be downloaded to the micro:bit. When it's done, press the A button on the board and see what happens!",
image: "images/step-16-a-button.jpg",
alt: "Picture of A button on micro:bit board"
},
{
title: "Teach the Inchworm to Walk",
description: "With the test code, the inchworm only takes one step. To change this, we need to modify the blocks to instruct it to do something different. To make it take more than one step, we can use a Loop. Use the block editor, change the code so it repeats the block multiple times, load it onto the inchworm, and try again.",
image: "",
alt: ""
},
{
title: "Attach Battery Pack to Servo",
description: "When you've gotten the inchworm to walk, it's time to free it from the computer so it can move on its own. Disconnect the USB cable and attach the large battery pack to the inchworm.",
image: "images/step-18-large-battery.jpg",
alt: "Large battery pack connected"
},
{
title: "Attach Battery Pack to Micro:bit",
description: "Connect the small battery pack to the micro:bit and attach it to the cardboard. This supplies power to the micro:bit.",
image: "images/step-19-small-battery.jpg",
alt: "Small battery pack connected"
},
{
title: "Connect the Large Battery Pack to the Servo",
description: "Move the red cable from 3V to the positive terminal on the battery pack. Attach one end of the fourth crocodile clip to the negative terminal on the large battery pack, and the other end to the crocodile clip that's in the GND connection on the micro:bit.",
image: "images/step-20-rewired-connections.jpg",
alt: "Rewired connections shown"
},
{
title: "Circuit Diagram for Battery Connection",
description: "This diagram shows how the circuit should look.",
image: "images/step-21-circuit-diagram.png",
alt: "Circuit diagram showing battery connections"
},
{
title: "Finished!",
description: "The inchworm is now complete! Now it's just time to experiment further. Bundle the wires together and secure them so they don't drag on the ground, decorate it to make it look nice, play with the code, adjust and experiment with the construction to see if you can make it walk as fast as possible, and last but not least, give it a name if it doesn't already have one!",
image: "images/step-22-finished-inchworm.jpg",
alt: "Finished inchworm"
}
],
ui: {
previous: "Previous",
next: "Next",
finish: "Finish!",
breadcrumb: "Step {current} of {total}"
}
},
no: {
title: "Mikro:bit Åme Monteringsveiledning",
steps: [
{
title: "Utstyr",
description: "Hent en utstyrspakke, og sjekk at alt grunn-utstyret er på plass:<ul><li>micro:bit brikke</li><li>Liten batteripakke</li><li>Stor batteripakke</li><li>USB-kabel</li><li>Pose med servo-motor</li><li>Fire krokodilleklemmer</li></ul>",
image: "images/step-01-equipment.jpg",
alt: "Alle tingene som en skal ha"
},
{
title: "Kroppen",
description: "Klipp ut en pappskive som skal bli kroppen til åma. Bruk micro:bit brikken som målestokk for å se hvor bred den må være. Start med den lenger enn du tror du trenger, lengden kan finjusteres senere.",
image: "images/step-02-body-cardboard.jpg",
alt: "Flat pappskive med microbit"
},
{
title: "Kroppsformen",
description: "Brett pappskiva på midten for å lage fasongen på kroppen. 'Knekk' den gjerne mot kanten på et bord, så blir det en finere brett. Dette blir midten på åma.",
image: "images/step-03-body-fold.jpg",
alt: "Pappbretting på midten"
},
{
title: "Kroppsformen - Føttene",
description: "Brett to mindre flipper på hver av endene, som åma kan 'stå' på bordet med. Dette blir føttene. Klipp til lengden så den blir passe lang. Om den er for lang kan den bli så stor at den ikke greier å gå, men om den blir for kort så får en ikke plass til alle delene.",
image: "images/step-04-body-feet.jpg",
alt: "Føttene på kroppen"
},
{
title: "Tenner",
description: "Brett inn hjørnene på den ene foten så den får to 'tenner' som den kan dra seg fremover med.",
image: "images/step-05-front-teeth.jpg",
alt: "Tennene foran"
},
{
title: "Bakbeina",
description: "Klipp ut noen flipper på den andre foten, og brett de til så den får 'fingre' på bakbeina som den kan dytte seg fremover med. Brett de opp og ned annahver gang, som på bildet.",
image: "images/step-06-back-fingers.jpg",
alt: "Fingrene på bakbeina"
},
{
title: "Fest Mikrobrikken",
description: "Klipp opp en bit med dobbeltsidig teip, eller ta en vanlig teip og brett den i to så den får lim på begge sider, og bruk denne til å feste mikrobrikken på fremsiden av åma, på den siden som har tenner.",
image: "images/step-07-microbit-attached.jpg",
alt: "Mikrobrikke på kroppen"
},
{
title: "Fest Servoen",
description: "Finn servoen og fest denne med teip på den andre siden av åma, der bakbeina er. Den må stå ut mot kanten av den ene siden, slik at den lille hvite knotten stikker ut på siden av pappen. Dette blir motoren som skal få åma til å bevege seg.",
image: "images/step-08-servo-attached.jpg",
alt: "Servo festet på ryggen"
},
{
title: "Krokodilleklemmer",
description: "Fest en krokodilleklemme på hver av de tre ledningene som kommer fra servoen. Velg gjerne krokodilleklemmer som har matchende farger med ledningene ut fra servoen om du kan, det gjør neste steg litt lettere. Pass godt på at metallet på hver av de ikke kan berøre hverandre, da det vil kortslutte kretsen. Bruk gummibeskyttelsen på krokodilleklemmene godt, og snurr rundt litt teip der de er festet sammen for sikkerhets skyld, hvis det trengs.",
image: "images/step-09-crocodile-clips.jpg",
alt: "Krokodilleklemmer på servoen med ekstra teip"
},
{
title: "Koble Servoen til Mikrobrikken",
description: "Fest den andre enden av hver av krokodilleklemmene til mikrobrikken. Pass på at riktig ledning kobles til riktig sted på mikrobrikken. Husk at det er kablene ut fra servoen som er styrende her, kablene på krokodilleklemmene kan ha andre farger. <ul><li><strong>Gul/Oransje ledning</strong> → Pin 0</li><li><strong>Rød ledning</strong> → 3V</li><li><strong>Svart ledning</strong> → GND</li></ul>",
image: "images/step-10-wiring-microbit.jpg",
alt: "Krokodiller festet til mikrobit"
},
{
title: "Fest Metalltråd til en Servoarm",
description: "Fest en god stump med metalltråd til en servo-arm. Brett en liten krok av tråden på enden, med den korte siden av kroken på 'innsiden' av armen. Denne skal festes til servoen, og bør kunne snurre fritt. Hvis den korte siden av kroken er for lang, kan den vikle seg rundt servoen når den beveger seg.",
image: "images/step-11-servo-arm-wire.jpg",
alt: "Servoarm med løs tråd"
},
{
title: "Fest Armen til Åma",
description: "Her skal vi lage 'musklene' som får åma til å bevege seg. Fest servoarmen til servoen, og fest den andre enden av metalltråden godt i pappen på motsatt side. Et tips kan være å stikke tråden inn i pappen og feste den med teip. Juster lengden på tråden, slik at når servoen skrus på og vipper frem og tilbake, så får åma en fin krypebevegelse. Når denne er festet, så er selve åma klar!",
image: "images/step-12-arm-attached.jpg",
alt: "Servoarm og tråd festet i pappen"
},
{
title: "Koble Åma til Datamaskinen",
description: "Nå er det på tide å be den om å gjøre noe. Fest USB-kabelen i mikrobrikken, og sett den i datamaskina. Mikrobrikken skal begynne å lyse.",
image: "images/step-13-usb-connection.jpg",
alt: "Brikke og USB"
},
{
title: "Åpne Kodeeditoren og Koble til Mikrobrikken",
description: "Åpne <a href='https://makecode.microbit.org/#editor' target='_blank'>MakeCode editoren</a> i nettleseren. Trykk på de tre prikkene, velg Connect Device, og følg oppskriften for å koble mikrobrikken til datamaskinen.",
image: "images/step-14-connect-device.jpg",
alt: "Skjermbilde av Connect Device knappen"
},
{
title: "Legg inn Testkode",
description: "Bygg denne kodeblokken i block-editoren, eller legg inn denne kodesnutten i javascript-editoren:<pre><code>input.onButtonPressed(Button.A, function () {\n pins.servoWritePin(AnalogPin.P0, 0)\n basic.pause(500)\n pins.servoWritePin(AnalogPin.P0, 180)\n basic.pause(500)\n})</code></pre>",
image: "images/step-15-test-code.jpg",
alt: "Skjermbilde av testkodeblokk"
},
{
title: "Test Åma",
description: "Trykk på Download knappen, og vent til koden blir lastet ned til mikrobrikken. Når den er ferdig, trykk på A-knappen på brikken, og se hva som skjer!",
image: "images/step-16-a-button.jpg",
alt: "Bilde av A-knappen på brikken"
},
{
title: "Lær Åma å Gå",
description: "Med testkoden går åma bare ett skritt. For å gjøre noe med dette, må vi endre på blokkene for å instruere den å gjøre noe annet. For å få den til å gå mer enn ett skritt, kan vi bruke en Loop. Bruk block-editoren, endre på koden slik at den gjentar blokken flere ganger, last den inn på åma, og prøv på nytt.",
image: "",
alt: ""
},
{
title: "Fest Batteripakken til Servo",
description: "Når dere har fått åma til å gå, er det på tide å frigjøre den fra datamaskina så den kan bevege seg på egen hånd. Koble den fra USB-kabelen, og fest den store batteripakken til åma.",
image: "images/step-18-large-battery.jpg",
alt: "Stor batteripakke koblet til"
},
{
title: "Fest Batteripakken til Mikrobrikken",
description: "Koble den lille batteripakken til mikrobrikken, og fest denne til pappen. Denne leverer strøm til mikrobrikken.",
image: "images/step-19-small-battery.jpg",
alt: "Liten batteripakke koblet til"
},
{
title: "Koble den Store Batteripakken til Servoen",
description: "Flytt den røde kabelen fra 3V til pluss-polen på batteripakken. Fest den ene enden på krokodilleklemme nummer fire i minus-polen på den store batteripakken, og den andre enden til krokodilleklemmen som står i GND koblingen på mikrobrikken.",
image: "images/step-20-rewired-connections.jpg",
alt: "Omkoblede ledninger"
},
{
title: "Kretstegning for å Koble til Batteripakken",
description: "Dette diagrammet viser hvordan kretsen skal se ut.",
image: "images/step-21-circuit-diagram.png",
alt: "Kretsdiagram som viser batteritilkoblinger"
},
{
title: "Ferdig!",
description: "Da er åma ferdig! Da er det bare å eksperimentere videre. Kveil sammen ledningene og fest de så de ikke drar i gulvet, pynt den så den blir fin, lek med koden, juster og eksperimenter med konstruksjonen og se om dere får den til å gå så raskt som mulig, og sist men ikke minst, gi den et navn om den ikke allerede har fått det!",
image: "images/step-22-finished-inchworm.jpg",
alt: "Ferdig åme"
}
],
ui: {
previous: "Forrige",
next: "Neste",
finish: "Ferdig!",
breadcrumb: "Steg {current} av {total}"
}
}
};
// ===== STATE MANAGEMENT =====
let currentLang = localStorage.getItem('workshop-lang') || 'no';
let currentStep = 0;
// ===== INITIALIZATION =====
function init() {
// Check URL hash for step number
const hash = window.location.hash.replace('#step-', '');
if (hash && !isNaN(hash)) {
const stepNum = parseInt(hash) - 1;
if (stepNum >= 0 && stepNum < content[currentLang].steps.length) {
currentStep = stepNum;
}
}
// Set initial language in button
document.getElementById('lang-label').textContent = currentLang === 'en' ? 'NO' : 'EN';
// Render initial content
renderContent();
updateNavigation();
// Event listeners
document.getElementById('lang-toggle').addEventListener('click', toggleLanguage);
document.getElementById('prev-btn').addEventListener('click', previousStep);
document.getElementById('next-btn').addEventListener('click', nextStep);
// Keyboard navigation
document.addEventListener('keydown', handleKeyboard);
// Handle hash changes (back/forward browser navigation)
window.addEventListener('hashchange', handleHashChange);
}
// ===== RENDERING =====
function renderContent() {
const data = content[currentLang];
const stepData = data.steps[currentStep];
// Update page title and header
document.title = data.title;
document.getElementById('main-title').textContent = data.title;
document.documentElement.lang = currentLang;
// Update breadcrumb
const breadcrumbText = data.ui.breadcrumb
.replace('{current}', currentStep + 1)
.replace('{total}', data.steps.length);
document.getElementById('breadcrumb-text').textContent = breadcrumbText;
// Render current step
const stepContent = document.getElementById('step-content');
// Build image HTML only if image is specified
const imageHTML = stepData.image ? `
<img src="${stepData.image}" alt="${stepData.alt}" class="step-image"
onerror="this.src='data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22600%22 height=%22400%22%3E%3Crect width=%22600%22 height=%22400%22 fill=%22%23f0f0f0%22/%3E%3Ctext x=%2250%25%22 y=%2250%25%22 dominant-baseline=%22middle%22 text-anchor=%22middle%22 font-family=%22Arial%22 font-size=%2224%22 fill=%22%23999%22%3EImage: ${stepData.image}%3C/text%3E%3C/svg%3E'">
` : '';
stepContent.innerHTML = `
<div class="step-container active">
<div class="step-number">${breadcrumbText}</div>
<h2 class="step-title">${stepData.title}</h2>
<div class="step-description">${stepData.description}</div>
${imageHTML}
</div>
`;
// Update URL hash
window.location.hash = `step-${currentStep + 1}`;
}
function updateNavigation() {
const data = content[currentLang];
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const prevText = document.getElementById('prev-text');
const nextText = document.getElementById('next-text');
// Update button states
prevBtn.disabled = currentStep === 0;
// Disable next button on last step
if (currentStep === data.steps.length - 1) {
nextBtn.disabled = true;
} else {
nextBtn.disabled = false;
}
// Update button text
prevText.textContent = data.ui.previous;
if (currentStep === data.steps.length - 1) {
nextText.textContent = data.ui.finish;
nextBtn.className = 'nav-btn btn-finish';
} else {
nextText.textContent = data.ui.next;
nextBtn.className = 'nav-btn btn-next';
}
}
// ===== NAVIGATION FUNCTIONS =====
function previousStep() {
if (currentStep > 0) {
currentStep--;
renderContent();
updateNavigation();
scrollToTop();
}
}
function nextStep() {
const totalSteps = content[currentLang].steps.length;
if (currentStep < totalSteps - 1) {
currentStep++;
renderContent();
updateNavigation();
scrollToTop();
}
// Do nothing on last step - button is disabled
}
function toggleLanguage() {
currentLang = currentLang === 'en' ? 'no' : 'en';
localStorage.setItem('workshop-lang', currentLang);
document.getElementById('lang-label').textContent = currentLang === 'en' ? 'NO' : 'EN';
renderContent();
updateNavigation();
}
function handleKeyboard(e) {
if (e.key === 'ArrowLeft') {
previousStep();
} else if (e.key === 'ArrowRight') {
nextStep();
}
}
function handleHashChange() {
const hash = window.location.hash.replace('#step-', '');
if (hash && !isNaN(hash)) {
const stepNum = parseInt(hash) - 1;
if (stepNum >= 0 && stepNum < content[currentLang].steps.length) {
currentStep = stepNum;
renderContent();
updateNavigation();
}
}
}
function scrollToTop() {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
// ===== START THE APP =====
init();
</script>
</body>
</html>