🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    FACES /apps/game.py doesn't run properly (solved)

    Scheduled Pinned Locked Moved FACES Kit
    1 Posts 1 Posters 4.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • PaulskptP Offline
      Paulskpt
      last edited by Paulskpt

      Hi, I just got a FACES set delivered.
      When exploring the apps that came with the UIFlow firmware (V1.3.3) I discovered the following:
      The script /apps/game.py did not run properly. It showed only the small icon image above the btnB position and a bigger version of this icon in the upper half of the display. However the latter did not change (which it should).
      I discovered that the source of the problem was: filenames of the image files that had more than 8 characters.
      In the folder /flash/img I changed file names of these three image files to: rock.jpg, paper.jpg and scissors.jpg.

      rps_img = (
      'img/rock_128.jpg',
      'img/paper_128.jpg',
      'img/scissors_128.jpg'
      )

      lcd.clear(lcd.WHITE)

      lcd.image(48, 200, 'img/rock_128.jpg', 2)
      lcd.image(143, 200, 'img/paper_128.jpg', 2)
      lcd.image(238, 200, 'img/scissors_128.jpg', 2)

      This fact did not crash the script but it worked only partially.
      I made the following modifications:
      a)

      rps_img = (
      'img/rock.jpg',
      'img/paper.jpg',
      'img/scissors.jpg'
      )

      b) since there was already defined rps_img, I used this in the following commands:

      lcd.image(48, 200, rps_img[0], 2)
      lcd.image(143, 200, rps_img[1], 2)
      lcd.image(238, 200, rps_img[2], 2)

      Another problem occurred after I flashed the device with the latest UIFlow firmware (V1.9.4) using M5Burner.
      Now the script /apps/game.py crashed because the function machine.random() does not exist anymore.
      The command: rand = machine.random(2) I replaced by:
      from random import randint
      rand = randint(0,2)

      Now the script ran again OK.

      Coding keeps your mind going

      1 Reply Last reply Reply Quote 1

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post