# Speicher Limit erreicht?

**URL:** <https://forum.calliope.cc/t/speicher-limit-erreicht/3061>\
**Category:** Fragen zu MakeCode/PXT\
**Created:** [25. Januar 2025 um 19:44 UTC](https://forum.calliope.cc/t/speicher-limit-erreicht/3061 "2025-01-25T19:44:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.calliope.cc/u/david)\
**Post date:** [25. Januar 2025 um 19:44 UTC](https://forum.calliope.cc/t/speicher-limit-erreicht/3061/1 "2025-01-25T19:44:35Z")

</div>

Hallo. Wir haben mit Hilfe von Claude 3.5 ein kleines „Fußball-Orakel“ für den Calliope 2 Mini erstellt. Siehe unten.  
Das Programm läuft, wenn wir nur maximal 20 Spielergebnisse reinladen. Bei einer größeren Anzahl von Spielen, funktioniert das Programm zwar immernoch im Test im Browser (Desktop) oder auf dem iPad, auf dem Calliope flackert aber nur noch die LEDs kurz auf.  
Kann mir jemand sagen, ob wir hier wirklich an das Speicherlimit kommen? Und wenn ja, dann würde mich interessieren, ob das mit dem Calliope 3 anders wäre.

Eigentlich war das Ziel alle Spiele des DFB Pokals reinzuladen. Vielleicht sogar in doppelt mit vertauschter Heim- und Auswärtsmannschaft. Das wären dann 2x63 Spiele.

Schöne Grüße

===

Funktionierender Code auf Calliope Mini 2:

```auto
let results = ["2:1","0:7","3:3","1:3","0:4","0:5","1:6","0:5","3:2","0:2","0:8","1:9","0:1","2:2","0:1","0:8","3:4","0:2","0:5","0:7"]
let penalties = ["","","4:2","","","","","","","","","","","4:1","","","","","",""]
let currentIndex = -1

// Function to pick a random match and show result
function showRandomResult() {
    currentIndex = Math.randomRange(0, results.length - 1)
    basic.showString(results[currentIndex])
}

// Function to show penalty result
function showPenaltyResult() {
    if (currentIndex >= 0) {
        if (penalties[currentIndex] !== "") {
            basic.showString(penalties[currentIndex])
        } else {
            basic.showString(results[currentIndex])
        }
    }
}

// Display soccer ball at start
basic.showLeds(`
    . # . # .
    # . # . #
    . # # # .
    # . # . #
    . # . # .
`)
basic.pause(1000)
basic.clearScreen()

// Button A: Pick random match and show result
input.onButtonPressed(Button.A, function() {
    showRandomResult()
})

// Button B: Show penalty result if available
input.onButtonPressed(Button.B, function() {
    showPenaltyResult()
})

// Shake: Show random "A" or "H"
input.onGesture(Gesture.Shake, function() {
    if (Math.randomBoolean()) {
        basic.showString("A")
    } else {
        basic.showString("H")
    }
})

```

Fehlerhafter Code wäre:

```auto
let results = let results = ["2:1","0:7","3:3","1:3","0:4","0:5","1:6","0:5","3:2","0:2","0:8","1:9","0:1","2:2","0:1","0:8","3:4","0:2","0:5","0:7","1:3","0:6","2:0","1:1","0:4","0:7","0:3","1:4","1:2","1:3","0:4","2:3","2:1","2:1","1:0","1:0","1:1","3:6","3:1","3:2","2:5","3:3","1:3","1:0","0:2","2:1","3:2","3:0"]
let penalties = ["","","4:2","","","","","","","","","","","4:1","","","","","","","","","","0:3","","","","","","","","","","","","","3:4","","","","","3:4","","","","","",""]
let currentIndex = -1

[...]

```

---

<div class="post-metadata">

**Author:** ![klmi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.calliope.cc/klmi/32/763_2.png) [@klmi](https://forum.calliope.cc/u/klmi)\
**Post date:** [26. Januar 2025 um 15:31 UTC](https://forum.calliope.cc/t/speicher-limit-erreicht/3061/2 "2025-01-26T15:31:59Z")

</div>

Hallo David,

Habe keinen V2 da. Nur einen V1 und V3.

Code läuft

// Button A: Pick random match and show result

input.onButtonPressed(Button.A, function () {

showRandomResult()

})

// Function to pick a random match and show result

function showRandomResult () {

currentIndex = Math.randomRange(0, results.length - 1)

basic.showString(„“ + (results[currentIndex]))

}

// Shake: Show random „A“ or „H“

input.onGesture(Gesture.Shake, function () {

if (Math.randomBoolean()) {

basic.showString(„A“)

} else {

basic.showString(„H“)

}

})

// Button B: Show penalty result if available

input.onButtonPressed(Button.B, function () {

showPenaltyResult()

})

// Function to show penalty result

function showPenaltyResult () {

if (currentIndex \>= 0) {

if (penalties[currentIndex] != „“) {

basic.showString(„“ + (penalties[currentIndex]))

} else {

basic.showString(„“ + (results[currentIndex]))

}

}

}

let currentIndex = 0

let penalties: string =

let results: string =

results = [

„2:1“,

„0:7“,

„3:3“,

„1:3“,

„0:4“,

„0:5“,

„1:6“,

„0:5“,

„3:2“,

„0:2“,

„0:8“,

„1:9“,

„0:1“,

„2:2“,

„0:1“,

„0:8“,

„3:4“,

„0:2“,

„0:5“,

„0:7“,

„1:3“,

„0:6“,

„2:0“,

„1:1“,

„0:4“,

„0:7“,

„0:3“,

„1:4“,

„1:2“,

„1:3“,

„0:4“,

„2:3“,

„2:1“,

„2:1“,

„1:0“,

„1:0“,

„1:1“,

„3:6“,

„3:1“,

„3:2“,

„2:5“,

„3:3“,

„1:3“,

„1:0“,

„0:2“,

„2:1“,

„3:2“,

„3:0“

]

penalties = [

„“,

„“,

„4:2“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„4:1“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„0:3“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„“,

„3:4“,

„“,

„“,

„“,

„“,

„3:4“,

„“,

„“,

„“,

„“,

„“,

„“

]

currentIndex = -1

// Display soccer ball at start

basic.showLeds(`

. # . # .

# . # .

. # # # .

# . # .

. # . # .

`)

basic.pause(1000)

basic.clearScreen()

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/calliope/original/2X/8/83b85332fcfb5fc7ff3148f01c8421e76e7128c4.png)

Vom Platz her passt es eigentlich.  
Außer du hast die Bluetootherweiterung geladen.

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.calliope.cc/u/david)\
**Post date:** [27. Januar 2025 um 08:16 UTC](https://forum.calliope.cc/t/speicher-limit-erreicht/3061/3 "2025-01-27T08:16:37Z")

</div>

Hey @klmi,  
vielen Dank für deine Antwort.

Ich muss ein paar Fragen dazu stellen:  
1/ Du konntest deinen Code auf dem Calliope 1 laufen lassen? Oder bezieht sich das auf den Calliope 3?

2/ Ich habe keine Veränderung an der standard Firmware vorgenommen. Und ich arbeite auch oft über Bluetooth. Also nehme ich an, ich nutze die Bluetootherweiterung. Kannst du mir sagen, wie ich das prüfen könnte?

3/ Netter Screenshot. Wie bekomme ich denn diese Übersicht?

Sorry, für die vielen Fragen.

Insgesamt glaube ich nicht, dass der Speicher des Calliope 2 überlastet ist. Ich habe mich eher gefragt, ob ich mit der Tabelle in ein Arbeitsspeicher oder Zwischenspeicher Problem laufe. Die Ursache scheint eindeutig. Bei 40 Spielen geht nichts. Bei 20 Spielen geht es. Irgendwo dazwischen liegt das Limit.

---

<div class="post-metadata">

**Author:** ![asp.net](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.calliope.cc/asp.net/32/2780_2.png) [@asp.net](https://forum.calliope.cc/u/asp.net)\
**Post date:** [27. Januar 2025 um 09:38 UTC](https://forum.calliope.cc/t/speicher-limit-erreicht/3061/4 "2025-01-27T09:38:26Z")

</div>

Vielleicht hilft das weiter:

[Calliope 2 stürzt ab bei bestimmten Array und Buffer Größen - Software Fragen und Probleme / Fragen zu MakeCode/PXT - Calliope](https://forum.calliope.cc/t/calliope-2-stuerzt-ab-bei-bestimmten-array-und-buffer-groessen/2716)

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.calliope.cc/u/david)\
**Post date:** [27. Januar 2025 um 12:29 UTC](https://forum.calliope.cc/t/speicher-limit-erreicht/3061/5 "2025-01-27T12:29:36Z")

</div>

Hallo @asp.net  
vielen Dank. Das war genau der Hinweis, den ich benötigt habe. Da wäre ich nie darauf gekommen.

Wenn ich die Projekteinstellungen um

```auto
{
    "yotta": {
        "config": {
            "microbit-dal": {
                "bluetooth": {
                    "enabled": 0
                }
            }
        }
    }
}

```

erweitere, kann ich ohne Probleme alle 126 Spielergebnisse des DFB Pokals 2023/2024 auf den Calliope laden. Das sind 63 Spiele und dann noch einmal alle Ergebisse mit vertauschter Heim- und Auswärtsmannschaft.

Den kompletten Code ergänze ich unten.

Vielen Dank und schöne Grüße

===

```auto
let results = ["2:1","0:7","3:3","1:3","0:4","0:5","1:6","0:5","3:2","0:2","0:8","1:9","0:1","2:2","0:1","0:8","3:4","0:2","0:5","0:7","1:3","0:6","2:0","1:1","0:4","0:7","0:3","1:4","1:2","1:3","0:4","2:3","2:1","2:1","1:0","1:0","1:1","3:6","3:1","3:2","2:5","3:3","1:3","1:0","0:2","2:1","3:2","3:0","2:0","1:2","1:0","1:4","2:0","3:1","2:0","3:3","2:2","1:3","3:2","2:1","0:2","4:0","0:1","1:2","7:0","3:3","3:1","4:0","5:0","6:1","5:0","2:3","2:0","8:0","9:1","1:0","2:2","1:0","8:0","4:3","2:0","5:0","7:0","3:1","6:0","0:2","1:1","4:0","7:0","3:0","4:1","2:1","3:1","4:0","3:2","1:2","1:2","0:1","0:1","1:1","6:3","1:3","2:3","5:2","3:3","3:1","0:1","2:0","1:2","2:3","0:3","0:2","2:1","0:1","4:1","0:2","1:3","0:2","3:3","2:2","3:1","2:3","1:2","2:0","0:4","1:0"]
let penalties = ["","","4:2","","","","","","","","","","","4:1","","","","","","","","","","0:3","","","","","","","","","","","","","3:4","","","","","3:4","","","","","","","","","","","","","","5:3","3:4","","","","","","","","2:4","","","","","","","","","","1:4","","","","","","","","3:0","","","","","","","","","","","","4:3","","","","","4:3","","","","","","","","","","","","","","3:5","4:3","","","","","","",""]
let currentIndex = -1

// Function to pick a random match and show result
function showRandomResult() {
    currentIndex = Math.randomRange(0, results.length - 1)
    basic.showString(results[currentIndex])
}

// Function to show penalty result
function showPenaltyResult() {
    if (currentIndex >= 0) {
        if (penalties[currentIndex] !== "") {
            basic.showString(penalties[currentIndex])
        } else {
            basic.showString("No penalties")
        }
    }
}

// Display soccer ball at start
basic.showLeds(`
    . # . # .
    # . # . #
    . # # # .
    # . # . #
    . # . # .
`)
basic.pause(1000)
basic.clearScreen()

// Button A: Pick random match and show result
input.onButtonPressed(Button.A, function() {
    showRandomResult()
})

// Button B: Show penalty result if available
input.onButtonPressed(Button.B, function() {
    showPenaltyResult()
})

// Shake: Show random "A" or "H"
input.onGesture(Gesture.Shake, function() {
    if (Math.randomBoolean()) {
        basic.showString("A")
    } else {
        basic.showString("H")
    }
})

```
