adafruit / Adafruit_CircuitPython_MagTag

Helper library for the Adafruit MagTag
MIT License
28 stars 24 forks source link

Received AttributeError on DISPLAY with magtag_simpletest.py #49

Closed ljmwaugh closed 3 years ago

ljmwaugh commented 3 years ago

This is the magtag that came with adabox017 It worked when I first plugged it in but I haven't been successful at loading any other program on it. This is with the latest library:
adafruit-circuitpython-bundle-6.x-mpy-20210101.zip

code.py

SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries

#

SPDX-License-Identifier: Unlicense

import time from adafruit_magtag.magtag import MagTag

magtag = MagTag()

magtag.add_text( text_position=( 50, (magtag.graphics.display.height // 2) - 1, ), text_scale=3, )

magtag.set_text("Hello World")

button_colors = ((255, 0, 0), (255, 150, 0), (0, 255, 255), (180, 0, 255)) button_tones = (1047, 1318, 1568, 2093)

while True: for i, b in enumerate(magtag.peripherals.buttons): if not b.value: print("Button %c pressed" % chr((ord("A") + i))) magtag.peripherals.neopixel_disable = False magtag.peripherals.neopixels.fill(button_colors[i]) magtag.peripherals.play_tone(button_tones[i], 0.25) break else: magtag.peripherals.neopixel_disable = True time.sleep(0.01)

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. code.py output: Traceback (most recent call last): File "code.py", line 7, in File "adafruit_magtag/magtag.py", line 84, in init File "adafruit_magtag/graphics.py", line 56, in init AttributeError: 'module' object has no attribute 'DISPLAY'

Press any key to enter the REPL. Use CTRL-D to reload. Adafruit CircuitPython 6.0.1 on 2020-12-28; Metro ESP32S2 with ESP32S2

import board dir(board) ['class', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'D0', 'D1', 'D10', 'D11', 'D12', 'D13', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'DEBUG_RX', 'DEBUG_TX', 'I2C', 'MISO', 'MOSI', 'NEOPIXEL', 'RX', 'SCK', 'SCL', 'SDA', 'SPI', 'TX', 'UART']

anecdata commented 3 years ago

It looks like circuitpython for the wrong device is loaded onto it (Metro ESP32S2). Did you update circuitpython with a new .bin or .uf2 file?

Here's the correct link for circuitpython for MagTag: https://circuitpython.org/board/adafruit_magtag_2.9_grayscale/. Main learn guide is here: https://learn.adafruit.com/adafruit-magtag

ladyada commented 3 years ago

hi @ljmwaugh happy new year. yeah please try deleting the lib folder on the magtag CIRCUITPY drive and starting at this step to install the latest and greatest circuitpy https://learn.adafruit.com/adafruit-magtag/circuitpython if you're still having issues, please post on forums.adafruit.com we have a team there that can help you! https://forums.adafruit.com/viewforum.php?f=59