#Unable to disable NeoPixel on MagTag
1 messages · Page 1 of 1 (latest)
I even tried the sample examples from https://circuitpython.readthedocs.io/projects/magtag/en/latest/examples.html and the part to disable the NeoPixel is not working
@pliant mist what behavior are you seeing? you set neopixel_disable to True and the neopixels stay on lit to whatever color they were previously?
I can try different colours and they still stay lit when I set disable to True
The Adafruit code examples/magtag_simpletest.py does not work
I can test this on my magtag tomorrow to see if I'm able to recreate the same behavior.
Great - Thanks - I've tried multiple samples and none seem to disable the neopixels ... well except for deep sleep
@pliant mist this doesn't sound like the same thing you were seeing. But just incase. If you're getting an error like this:
code.py output:
Traceback (most recent call last):
File "code.py", line 7, in <module>
File "adafruit_magtag/magtag.py", line 102, in __init__
File "adafruit_magtag/peripherals.py", line 46, in __init__
TypeError: function missing required positional argument #3
go head and update your magtag and neopixel libraries to their newest versions. Mine was originally giving me this error until I updated them.
@pliant mist it seems to be tied to the MagTag library specifically. Bypassing the library and initializing digitalio for the power pin and neopixel on the neopixel pin directly does result in the power pin enabling / disabling the neopixels as expected. I'm taking a closer look into the library to see if I can figure out why it's working this way.
@pliant mist I've figured out the root cause of this issue. There is a PR here that resolves it: https://github.com/adafruit/Adafruit_CircuitPython_MagTag/pull/76 If you are interested you can grab the library code from that branch and it use it on your device. It should allow you to enable / disable the neopixels. You can also wait for it to get merged into the library and get it from the bundle using the normal process after the merge and release occur.
@pliant mist okay that got reviewed very quickly so we've got it merged now. The updated library is currently available on the release page on github: https://github.com/adafruit/Adafruit_CircuitPython_MagTag/releases/tag/2.1.4 or starting tomorrow it should also be included in the bundle download as normal.
Thanks - I'll give it a try
While waiting around, I went and tried the Mag Tides Viewer example - https://learn.adafruit.com/magtag-tides-viewer?view=all - with the latest libraries of course BUT the HI / LO times do not show. I'm all new to this stuff but I found the HiLo times are being retrieved correctly but they are not displaying on the MagTag. Any ideas?
I don't have any idea off th etop of my head but I can test out that project as well in a bit to try to see whats up with it.
@lucid raptor I found the issue. In the file code.py on the web (https://learn.adafruit.com/magtag-tides-viewer?view=all) it needs one line which is missing. In the function def show_hilo(): one more line needs to be added at the end hilo_times[i].hidden = False Then the program works as it should
Nice find! great job troubleshooting that. We can make a PR for the Learn System code repo to get that fixed for folks using that project in the future.
@lucid raptor I'm not sure where to report this?
The best place is here: https://github.com/adafruit/Adafruit_Learning_System_Guides/issues if you have a Github account feel free to create an issue here. If you do, please include information about which specific project it's for (this repo houses code for many projects) and you can include your findings about how you resolved it.
If you're interested in getting more involved you could make the PR to fix it as well, we have a guide that can help you through that process if you do want to take it on. No worries if you'd rather not though I'll get it taken care of later today if no one gets to it sooner.
Thanks @lucid raptor .... I added an issue there with solution. Back to original problem: I tried those new libraries you gave me but it still does not disable the NeoPixel.
I'm using this code to test: ```import time
from adafruit_magtag.magtag import MagTag
magtag = MagTag()
button_colors = ((0, 255, 0), (255, 0, 0), (255, 255, 0), (0, 0, 255))
button_low_tones = (130.82, 146.83, 164.81, 174.61)
button_mid_tones = (261.63, 293.66, 329.63, 349.23)
while True:
print("Now enable the NeoPixels")
magtag.peripherals.neopixel_disable = False
#magtag.peripherals.neopixels[1].fill(button_colors[3])
magtag.peripherals.neopixels[0] = button_colors[0]
magtag.peripherals.neopixels[1] = button_colors[1]
magtag.peripherals.neopixels[2] = button_colors[2]
magtag.peripherals.neopixels[3] = button_colors[3]
time.sleep(2)
print("Now disable the NeoPixels")
magtag.peripherals.neopixel_disable = True
time.sleep(2) ```
Just to confirm. You downloaded the 2.1.4 mpy files from the release page? https://github.com/adafruit/Adafruit_CircuitPython_MagTag/releases/tag/2.1.4
Maybe double check by deleting the adafruit_magtag library from your device and pasting in the one downloaded from that page.
I'm heading to a meeting in a moment but I'll try your code above afterward.
Sorry @lucid raptor I saw the complete library had todays date so I just assumed it included the changes https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/download/20211210/adafruit-circuitpython-bundle-7.x-mpy-20211210.zip
Once I used the 2.1.4 mpy files, the code worked .... Yay
No worries and Hooray, glad it's working correctly for you now. Thanks for reporting this issue about the neopixels as well as looking into and reporting that one for the tides project.
Great. I actually discovered the issue while running the MagTag Sports Schedule Viewer. I glad to say that is working now as expected Except the last line of text it is slightly chopped off https://learn.adafruit.com/assets/99739
The text "Game status: Final" is missing a pixel or two at the bottom. I'm using the stock standard code from the project. I'm assuming one of the libraries got updated and is the cause of the problem. Where would I report it? I have no idea how to debug this?
I think you are probably right about a change to one of the libraries shifting the text slightly to one direction or another (sounds like down in this case). I think it is best to fix it in that project, the change to the library could have been intentional if it was found that the positioning was not working as intended and corrected.
You can make another issue on the Learn Guide repo for that one as well if you'd like. If you're able to snap a photo of your device with the text cut off and add that to the issue that would be great as well.
Will do - Thanks
I think this would be the spot to change / fix it ultimately: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/0db1ba2c12a843a797793b09b731a7e726cb8c52/MagTag_Sports_Schedule/code.py#L235-L238
The position argument passed to add_text() there can have it's Y value lowered a little bit and it will scoot the text back upwards by that amount.