Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Feather M0 Express!
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Feather M0 Express!

by nis_ on Sun Jul 09, 2017 5:37 pm

tannewt2 wrote:I'm glad you are liking it nis_! When you say you'd like the status pixel off semi-permanently, when would you like it on and when would you like it off? Its pretty easy to turn off with a custom build but I haven't exposed any long-lasting configuration for it yet from CircuitPython.

Thanks!
~Scott


Hi Scott. Thanks for the fast response!

I would be fine with not having the status pixel flashes present (at all).

For the wish list:

A simple dropfile:
Code: Select all | TOGGLE FULL SIZE
 $ cd /media/mylogin/CIRCUITPY ; > .NO_BLINKING


Would tell the machine that the human does not wish to see self-illuminating messages from the machine. "until further notice" (until the machine is told this objection no longer obtains, by a removal):
Code: Select all | TOGGLE FULL SIZE
 $ cd /media/mylogin/CIRCUITPY ; rm ./.NO_BLINKING


I know this as the 'dropfile' or 'file-semaphore' system of interprocess communication (signalling).

The override .. would be the presence of any explicits in code.py requesting NeoPixel services. Just as it works already.

reference system details:
Code: Select all | TOGGLE FULL SIZE
$ uname -s -r ; cat /etc/os-release | sed 1q
Linux 3.16.0-4-amd64
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"





tannewt2 wrote:When you say you'd like the status pixel off semi-permanently, when would you like it on and when would you like it off?

When .. when I'm trying to repair a code blunder I've made, and know I've made it, and exactly what needs to be done, to put it to rights -- I would like the machine to, at most, mention it.

And then drop the matter.

As it stands, the message:

GREEN -- CYAN -- DARK -- YELLOW -- DARK -- CYAN -- DARK-DARK

endlessly repeats itself, when all I did was misuse the '// comment' sytnax -- when I meant '# comment' .. and there's a lot of them (commented-out lines) that have occurred, since the last save-to-disk.

I would the machine simply have cleared it's throat, and maybe uttered:

AHEM.

Tap on the podium with the baton. Once, maybe twice.


Since I'm invariably using the keyboard when the status pixel begins talking, acknowledging by keyboard seems appropriate enough -- I'm already there. Distracted, but physically, hands are still on the keyboard.

Having it (REPL >>) respond to any keyboard input by shutting off the blinkenness would probably work just fine (I suggest spacebar flogging, for a keybinding that is unambiguous).

So, as soon as the event that triggers the flashiness occurs, the human simply slaps the spacebar with the thumb, at a blank REPL >> prompt. That would inform the keystroke acquisition routine that the human operator has acknowledged whatever the machine has most recently warned the human (or the kitten inspecting things on the desk) about.

Any (any!) code.py requested services would be immune from this feedback system -- whatever else one does, as things stand, now, to stop it from blinking, one would continue to do.

So, if I code two short blinks at the beginning of the program, those would go off and would not expect any reply from me, in the form of keystrokes.

. . .

Thanks for enduring my explanation, Scott. It's appreciated. I'm not expecting you to implement anything -- I was asking if something was already available that I'd overlooked.

. . .
NeoPixel status is also fine just the way it is, by the way (it's interesting and a novel use of colour) and I'm very appreciative that you and the others brought CircuitPython (and devices that run on it) to market -- it's really quite exciting!

I'm putting just about all my microcontroller project interests into the SAMD21G18A -- I have three of them here, and a fourth is on its way (Metro M0 Express).

I accidentally became fascinated with CircuitPython, in the last 40 hours or so. You guys got me with the CircuitPlayground Express (SAMD21-based) which I somehow overlooked -- with the elaborate sensor package .. affixed .. (as with postage).

The plurality of the offerings is really something, and I tell anyone who'll listen, about what's going on here!

73,
Christopher
WA1TNR

nis_
 
Posts: 12
Joined: Mon Feb 13, 2017 9:28 pm

Re: Feather M0 Express!

by tannewt on Mon Jul 10, 2017 1:40 pm

Thanks Christopher! I've added an issue to track this request here: https://github.com/adafruit/circuitpython/issues/162

The flashing should already stop when you hit any button to enter the REPL. I believe its set to be white when in the REPL.

I'm happy to hear you are digging the CircuitPlayground Express. We're all super excited about it.

~Scott

tannewt
 
Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Re: Feather M0 Express!

by nis_ on Wed Jul 12, 2017 5:32 pm

tannewt2 wrote:Thanks Christopher! I've added an issue to track this request here: https://github.com/adafruit/circuitpython/issues/162

The flashing should already stop when you hit any button to enter the REPL. I believe its set to be white when in the REPL.

I'm happy to hear you are digging the CircuitPlayground Express. We're all super excited about it.

~Scott


Thanks for putting in that request!

scott> white blinkie not blinkie in REPL
nis_> d'oh!

The fact that the NeoPixel (in WHITE) stays on (steadily) in REPL was overlooked by me.

The observation that it doesn't .. blink .. was especially helpful.

Thanks!

. . .

scott> custom build
nis_> hrrm.

I was able to follow Tony DiCola's write-up (very nicely done):

[ https://learn.adafruit.com/micropython- ... d-firmware ]
Code: Select all | TOGGLE FULL SIZE
Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 2.0.0-alpha.0-15-gb6ebf85-dirty on 2017-07-12; Adafruit Metro M0 Express with samd21g18
>>>
(happened to be using Metro M0 Expr. today)

So, I came at the problem from two angles. The first was a simple repression of most colors emitted (by emitting black, aka nothing, but with a value of 0x000000 nothing).

I was able to do so with a one-line addition to rgb_led_status.c (see diff, below).

The second approach was to tone down the NeoPixel brightness by adjusting RGB values, in the include file (rgb_led_colors.h).

Code: Select all | TOGGLE FULL SIZE
 $ cat rgb_led_colors.h | egrep $VARIOUS

//                 rrggbb                      rrggbb
+#define GREEN   0x000100 // #define GREEN   0x001000

+#define REPL_RUNNING BLUE  // #define REPL_RUNNING WHITE

The TX LED (Metro M0 Express) is considerably brighter to the
eye, than this BLUE (above).
Code: Select all | TOGGLE FULL SIZE
Script started on Wed 12 Jul 2017 06:42:16 PM UTC

vbox $ pwd
/home/vagrant/source/circuitpython/atmel-samd

vbox $ md5sum rg*backup*
fd2109dcdb79caaeefcb20999733a0ce  rgb_led_colors.h__backup__
159757158afa64e2677ee084bcccbccc  rgb_led_status.c__backup__

vbox $ ls -la rg*backup*
-rw-rw-r-- 1 vagrant vagrant  795 Jul 12 03:37 rgb_led_colors.h__backup__
-rw-rw-r-- 1 vagrant vagrant 6207 Jul 12 03:37 rgb_led_status.c__backup__

Instead of wearing sunglasses, dim sun:
Code: Select all | TOGGLE FULL SIZE
vbox $ diff -u ./rgb_led_colors.h__backup__  ./rgb_led_colors.h
--- ./rgb_led_colors.h__backup__        2017-07-12 03:37:22.684405207 +0000
+++ ./rgb_led_colors.h  2017-07-12 18:59:03.154624528 +0000
@@ -1,18 +1,18 @@
 #define BLACK   0x000000
-#define GREEN   0x001000
-#define BLUE    0x000010
-#define CYAN    0x001010
-#define RED     0x100000
+#define GREEN   0x000100 // #define GREEN   0x001000
+#define BLUE    0x000001 // #define BLUE    0x000010
+#define CYAN    0x000101 // #define CYAN    0x001010
+#define RED     0x010000 // #define RED     0x100000
 #define ORANGE  0x100800
 #define YELLOW  0x101000
-#define PURPLE  0x100010
-#define WHITE   0x101010
+#define PURPLE  0x010001 // #define PURPLE  0x100010
+#define WHITE   0x010101 // #define WHITE   0x101010
 
 #define BOOT_RUNNING BLUE
 #define MAIN_RUNNING GREEN
 #define SAFE_MODE    YELLOW
 #define ALL_DONE     GREEN
-#define REPL_RUNNING WHITE
+#define REPL_RUNNING BLUE  // #define REPL_RUNNING WHITE
 
 #define ACTIVE_WRITE 0x200000

This one-liner covers the most common blinkie events, by making them go black:
Code: Select all | TOGGLE FULL SIZE
 
vbox $ diff -u ./rgb_led__status.c__backup__ ./rgb_led_status.c
--- ./rgb_led_status.c__backup__        2017-07-12 03:37:22.684405207 +0000
+++ ./rgb_led_status.c  2017-07-12 18:59:24.393239999 +0000
@@ -95,6 +95,7 @@
         return;
     }
     current_status_color = rgb;
+    // rgb = 0; // wa1tnr 12 July
     #endif
 
     #ifdef MICROPY_HW_NEOPIXEL
END_OF_DIFF


John Muir Publications (Santa Fe?) put out the famous VW (automobile) repair book, at some point in the past.

One of the pro tips from that book has always stayed with me. Paraphrased:
Sometimes the Engine Oil indicator will glow dimly on the dashboard for no reason; if it bothers you, paint over it with dark nail polish.


Brilliant (hehe).

nis_
 
Posts: 12
Joined: Mon Feb 13, 2017 9:28 pm

Re: Feather M0 Express!

by KyleMohr on Wed Jul 12, 2017 10:30 pm

Currently trying to get the 2x2 LED button box up and running per the tutorial here: https://learn.adafruit.com/arcade-button-control-box/overview

Seems the Feather Express M0 won't boot into or function as an HID keyboard or output signals to the LEDs or react to the button pushes. Getting the green and blue led just rotating over and over.

Have put into boot mode multiple times, uploaded the UF2, then from Circuitpy uploaded the HID folder, and then added the main.py and still, anytime it is in circuitpy mode, the board LED just rotates green and blue again with no signal response.

I even tried to upgrade the board firmware and when I reload the software after flashing the board, then the UF2, the HID and main.py files I had on there before still remain. Have tried this multiple times on both mac and pc, both with same result. Only thing changed in the base code was how many buttons.

Any suggestions or help to factory reset the board would be greatly appreciated.

Thanks!
Attachments
20046078_10100189399953073_902626454_n.png
20046078_10100189399953073_902626454_n.png (12.61 KiB) Viewed 859 times
19987696_10100189394808383_1289537833_n.png
19987696_10100189394808383_1289537833_n.png (16.78 KiB) Viewed 859 times
19897538_10100189369983133_1533516555_o.jpg
19897538_10100189369983133_1533516555_o.jpg (76.23 KiB) Viewed 859 times
Last edited by KyleMohr on Thu Jul 13, 2017 12:53 am, edited 1 time in total.

KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Re: Feather M0 Express!

by dhalbert on Wed Jul 12, 2017 10:44 pm

It would be better to start a new topic on this, but we can continue here.

1. What's the name of the CircuitPython .uf2 file that you are copying to FEATHERBOOT?
2. What is in boot_out.txt?
3. What version of Windows are you running? Did you install the Adafruit drivers package?
4. What is in main.txt? Is it exactly the code in the tutorial?
5. If you connect to the board via Putty or Tera Term, and do a soft-reload by typing ctrl-D, what do you see?

And a note: reloading CircuitPython does NOT erase the files in CIRCUITPY on an Express board. That's a good thing, since it preserves your code. (On a Feather M0 Basic or similar without a separate SPI flash chip, CIRCUITPY will get erased.)

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Feather M0 Express!

by KyleMohr on Thu Jul 13, 2017 12:41 am

1. What's the name of the CircuitPython .uf2 file that you are copying to FEATHERBOOT?
adafruit-circuitpython-feather_m0_express-1.0.0-rc.4.uf2
2. What is in boot_out.txt?
Nothing, its blank, tried removing it and it comes back automatically
3. What version of Windows are you running? Did you install the Adafruit drivers package?
Windows 7 I believe, also does the same with the latest Mac OS.
4. What is in main.txt? Is it exactly the code in the tutorial?
Yes, same code from tutorial. I tried both edited and unedited versions and same non-response

KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Re: Feather M0 Express!

by adafruit2 on Thu Jul 13, 2017 1:11 am

please use a serial terminal program to see what the output from the python interpretter says, it can help you debug!

adafruit2
Site Admin
 
Posts: 19398
Joined: Fri Mar 11, 2005 7:36 pm

Re: Feather M0 Express!

by dhalbert on Thu Jul 13, 2017 7:17 am

(repeat) 5. The green/blue flashing alternation indicates that your program is throwing an error. It could just be a typo, or something else. So please yes, connect a terminal program to see what's going on. Here's how to do that: https://learn.adafruit.com/micropython- ... l-terminal.

If it's not clear to you what the error is after you look, post the contents of main.txt here. Post it between [ code]...[ /code] tags (without the spaces after the "[") so it's easy to read and we can see the spacing (indentation is significant in Python, as you probably know). You can use the "</>" button to do that easily.

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Feather M0 Express!

by KyleMohr on Fri Jul 14, 2017 3:34 pm

Thanks! While trying to see what the possible error could be, please see below the contents of main.txt (or main.py). Any suggestions or updates are welcomed, simply want button LEDs to light, and keyboard presses of a, b, c, d. I based this off the original code, and tweaked it with Noe who created the tutorial, and we couldn't seem to debug it. Was worried I could've possibly received a board that shipped in a weird bootloader mode.

Again, I appreciate all the help!

Code: Select all | TOGGLE FULL SIZE
import digitalio
from board import *
import time
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

# A simple neat keyboard demo in circuitpython

# The button pins we'll use, each will have an internal pullup
buttonpins = [D12, D11, D10, D9]
ledpins = [A1, A2, A3, A4]

# The keycode sent for each button, will be paired with a control key
buttonkeys = [Keycode.A, Keycode.B, Keycode.C, Keycode.D]

# the keyboard object!
kbd = Keyboard()
# our array of button objects
buttons = []
leds = []

# make all pin objects, make them inputs w/pullups
for pin in buttonpins:
    button = digitalio.DigitalInOut(pin)
    button.direction = digitalio.Direction.INPUT
    button.pull = digitalio.Pull.UP   
    buttons.append(button)
for pin in ledpins:
    led = digitalio.DigitalInOut(pin)
    led.direction = digitalio.Direction.OUTPUT
    leds.append(led)

led = digitalio.DigitalInOut(D13)
led.switch_to_output()
 
print("Waiting for button presses")

while True:
    # check each button
    for button in buttons:
        if (not button.value):   # pressed?
            i = buttons.index(button)
            leds[i].value = True
           
            print("Button #%d Pressed" % i)

            # turn on the LED
            led.value = True

            while (not button.value):
                pass  # wait for it to be released!
            # type the keycode!
            k = buttonkeys[i]    # get the corresp. keycode
            kbd.press(k)
            kbd.release_all()

            # turn off the LED
            led.value = False
            leds[i].value = False
   
    time.sleep(0.01)

KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Re: Feather M0 Express!

by adafruit2 on Fri Jul 14, 2017 4:09 pm

thanks!
please use a serial terminal program to see what the output from the python interpretter says, it can help you debug!

adafruit2
Site Admin
 
Posts: 19398
Joined: Fri Mar 11, 2005 7:36 pm

Re: Feather M0 Express!

by dhalbert on Fri Jul 14, 2017 10:53 pm

I tried your code as posted and it works fine. I simulated buttons with a jumper.

If you want to know the version of the bootloader you have, double-click to get the FEATHERBOOT drive, and then look in INFO_UF2.TXT. The version should be 1.22 or above. If it's older, you can find a newer version here.

You might want to recheck your wiring, but I don't have a theory as to why the bootloader or the wiring would be causing an error.

By far the best way to know what's going wrong is looking at the serial output, as we've mentioned.

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Feather M0 Express!

by KyleMohr on Sat Jul 15, 2017 12:03 am

Maybe its my board then, because I've used the same code, with both just a jumper wire touching ground and any of the D12-D9 pins with no response, as well as soldering the buttons, with no change.

Also Checked bootloader, which is v1.22.

Looking at terminal log, I've gotten the following:

Adafruit CircuitPython 1.0.0-rc.4 on 2017-07-07; Adafruit Feather M0 Express with samd21g18

File "<stdin>", line 1
SyntaxError: invalid syntax

File "<stdin>", line 1, in <module>

File "<stdin>", line 1, in <module>
NameError: name 'board' is not defined

KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Re: Feather M0 Express!

by dhalbert on Sat Jul 15, 2017 12:25 am

You should see more than that in the terminal log, and the <stdin> errors are suspicious: you should see errors in main.txt if there are problems there. Can you type at it and get a >>> prompt? Can you type ctrl-D and get it to auto-reload? Which terminal program are you using? Try Tera Term instead of putty: it reopens the connection automatically after a disconnect.

It's possible the filesystem is damaged. Does Windows report trouble with the CIRCUITPY drive when you first plug it in?

To erase the SPI flash chip, load this UF2: https://github.com/dhalbert/Adafruit_SP ... xpress.uf2. When you first load it, the on-board Neopixel will turn blue. About 15 seconds later it should flash green, which means it's done. Then you'll need to reload the CircuitPython UF2 and recopy main.txt and adafruit_hid to CIRCUITPY.

After you copy those files, eject the drive from the task bar or by right-clicking in an Explorer window. That will ensure that all the files have been written completely. Don't press the reset button or unplug the board before doing an eject on Windows.

I'll check back in the morning.

dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Feather M0 Express!

by KyleMohr on Sat Jul 15, 2017 12:59 am

Got the >>> prompt, ctrl-D did reload.

Once reloaded I received:
main.py output:
Traceback (most recent call last):
File "main.py", line 1
SyntaxError: invalid syntax

Using Mac Terminal (with CP210x USB to UART Bridge VCP Drivers installed).

Did the flashing process twice now, reinstalled everything, and still no response.....

Thanks again for your help!

KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Re: Feather M0 Express!

by tannewt on Sat Jul 15, 2017 1:18 am

Hi Kyle, please try erasing the SPI flash per dhalbert's instructions. I develop CircuitPython on Mac OSX so I expect that to be OK.

What serial program are you using?

Thanks and sorry for the trouble.

tannewt
 
Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.