[SOLVED] M&M Sorter - WGet command for Python script download



Hey guys -

I’m working on the M&M Color sorter(https://www.dexterindustries.com/projects/raspberry-pi-mm-color-sorter/) project, but got hung up on the downloading the python code from Github.

The command listed in the project is:
sudo wget https://github.com/DexterInd/PivotPi/blob/master/Software/Python/Projects/M%26Ms%20Sorter/PivotPi_BrickPi3_M%26Ms_Sorter.py

But the results I get are “404 Not Found”:

Is anyone else getting the same error?

I don’t use Github or Linux enough to be able to know the right path/context…



Ok, I think I got it…

If anyone else tries it, I believe this URL will work…

sudo wget “https://github.com/mattallen37/PivotPi/blob/b3ff767024f7824a8d722524045ead5e551bd9e9/Software/Python/Projects/M%26M’s%20Sorter/PivotPi_BrickPi3_M%26Ms_Sorter.py



Hi @dkahl96,

Neither of these will work. You have to do something like:

wget https://raw.githubusercontent.com/mattallen37/PivotPi/b3ff767024f7824a8d722524045ead5e551bd9e9/Software/Python/Projects/M%26M's%20Sorter/PivotPi_BrickPi3_M%26Ms_Sorter.py

What I did was to copy-paste the link to the raw-text file. Not the actual html version of it.

Thank you!


Ahh…I gotcha now.

That worked - thanks for the tip!


Thanks for bringing this up! When @Matt is back, he will get the code into the directory. Thanks!


Sounds good, thanks John. Another question on an error I’m receiving -

Has anyone else seen this before? I’m wondering if I need to download the drivers for the Lego Touch and Color sensors, or if I need to get the whole M&M sorter built out before I can test it a little bit…thoughts?




Hey guys, just wanted to follow up on this thread. Is anyone at Dexter reading these posts? Are there any more logs or error messages I can provide to help troubleshoot this?




Hey @dkahl96 I assure we are reading these posts! We don’t have any update on it yet though!


The project program is now in the repo here.

The original was written prior to the release of the BrickPi3, and since then several things have changed. One of the main things is how sensor errors are dealt with. Previously there was a value returned from get_sensor that would specify any errors, but now get_sensor raises an exception if there is an error. The updated project program has been modified to deal with the exceptions.

Some of the values in the code are specific to the hardware being used, and will need to be calibrated/adjusted for your hardware. On line 11 you can specify the actual frequency of your PivotPi (probably somewhere between 59 and 64Hz). On lines 74 through 76 you can set the calibration values for the color sensor (minimum and maximum RGB values). Optionally you can also change the ports on lines 15 through 18.


@JohnC & @Matt - thank you guys so much for getting back to me! I really appreciate it.

@Matt, thanks for the updated repo, and everything you said makes complete sense. I’ll give that a shot. My 10 year old son is really enjoying this project (and so am I) and I didn’t want him to lose his interest! :slight_smile:

Thanks again, and I’ll share pics on twitter once it’s all done!



Excellent! Thanks for letting us know @dkahl96!