UnicycleDumpTruck/MissionControl

Arduino

technoj opened this issue · 22 comments

Can you post the arduino code and some schematics?

The Arduino code is there in the .ino file. I'm afraid I don't have it in me to draw up a set of schematics. If you are looking to create your own similar contraption, I recommend you do a few tutorials (Adafruit has good ones, IIRC) and get comfortable using the MCP23017 input/output expander and the HT16K33 LED matrix driver. The desk is basically just a Raspberry Pi communicating over USB to an Arduino that has a five HT16K33's and four MCP23017's.

Thank you!

Where did you get the square push buttons? And are they LED? I have one that has a small bulb in it but I don't know if that would be able to be arduino controlled.

The illuminated pushbuttons came from Adafruit. They include a blue 5mm LED with a resistor already soldered on. I pulled the stock LED and chopped the bulb holder down so it was just the base part. Then I had room to thread a 10mm green LED onto the bulb holder. My labels slipped under the clear pushbutton cover, over the diffuser.

Jeff :)

So is the arduino connected to the raspberry pi like this?
http://blog.oscarliang.net/raspberry-pi-and-arduino-connected-serial-gpio/

I had them set up like that at one time, but now just use a USB cable.

Jeff :)

Sorry to be asking so many questions, but do you have to install Arduino IDE on the pi? I know how to do that, I am just wondering if it is necessary.

You could if you want to do the Arduino programming on the Pi, but. I found that too slow, so just did the cable swap dance, and did the programming with my laptop.

Jeff :)

I also got this message:
Line 39
serialFromArduino.write(b'1,4,4,1,1\n')
^
SyntaxError: invalid syntax
any suggestions?

Have you installed the python-serial package?

Jeff :)

From github?

On Mar 4, 2014, at 11:33 AM, BabyWrassler notifications@github.com wrote:

Have you installed the python-serial package?

Jeff :)

Reply to this email directly or view it on GitHub.

No, with:
sudo apt-get install python-serial
on the RPi's command line.
Jeff :)

Not yet. Thanks. I am not at home right now but when I get back I will run that. I think i still have some code errors so I will post those when it runs. You can tell this is my first time running python on my pi! :)

On Mar 4, 2014, at 11:41 AM, BabyWrassler notifications@github.com wrote:

No, with:
sudo apt-get install python-serial
on the RPi's command line.
Jeff :)

Reply to this email directly or view it on GitHub.

Ok. I did that, but am getting a message on the pi for line 321 with a red highlight on the last quote on the line
image

any suggestions?

I can't think of anything, but then I only just learned enough Python for this project, and even just today found another bug I missed (relative links to the sound files, causing them not to play when the script is run on boot from the rc.local file). That particular line isn't necessary, just gives an idea of when the startup is complete. I suspect, though, that the error is elsewhere and somehow just conflicting with that line. It's probably time to start commenting out sections of code until it works, and then bring them back bit by bit until you can find what's causing the problem.

Commenting as in posting or as in deleting on my pi?

I meant commenting out as in putting "#" at the beginning of the line in the python script so the line is treated as a comment and not run as code. Let's say you had two lines of code in a script and the script was giving an error when run. You could comment one line out, try to run the script, and see if the error still pops up. If the error goes away, it was in the line you commented out. Often I have to comment out whole sections of code or copy code to a new, shorter script to see if I can get the smaller sections to run individually before running it all together.

Jeff :)

On Mar 8, 2014, at 22:57, technoj notifications@github.com wrote:

Commenting as in posting or as in deleting on my pi?


Reply to this email directly or view it on GitHub.

I think I figured out the problem. It says I need something called pygame.mixer. How do I install that? Please answer if it's not answered here by the time you read this.
http://raspberrypi.stackexchange.com/q/14317/11800?sem=2

Not sure if this link helps you, but i am also relatively new to the pi and this is what I have been using as a starting reference.
http://fengidea.com/UPloadFiles/Getting%20Started%20With%20Raspberry%20Pi.pdf

~Kyle

That book is terrific, I heartily recommend it. It is available for purchase at:
http://www.makershed.com/Getting_Started_with_Raspberry_Pi_p/9781449344214-p.htm

I actually have that book, but I never read all the way to that spot. I got that working I think. My problem now is that I cannot get the Arduino to run. I imported all of the libraries, and even did the sketch > import library on each one. Here is my log:

mcDesk.ino:2:53: error: Adafruit_LEDBackpack.h: No such file or directory
mcDesk.ino:3:45: error: Adafruit_GFX.h: No such file or directory
mcDesk:11: error: variable or field 'matrixOff' declared void
mcDesk:11: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:11: error: expected primary-expression before 'buffer'
mcDesk:12: error: variable or field 'ledOn' declared void
mcDesk:12: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:12: error: expected primary-expression before 'buffer'
mcDesk:12: error: expected primary-expression before 'cat'
mcDesk:12: error: expected primary-expression before 'an'
mcDesk:13: error: variable or field 'ledOff' declared void
mcDesk:13: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:13: error: expected primary-expression before 'buffer'
mcDesk:13: error: expected primary-expression before 'cat'
mcDesk:13: error: expected primary-expression before 'an'
mcDesk:14: error: variable or field 'dispMat' declared void
mcDesk:14: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:14: error: expected primary-expression before 'buffer'
mcDesk:17: error: variable or field 'threeDigitDisp' declared void
mcDesk:17: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:17: error: expected primary-expression before 'buffer'
mcDesk:17: error: expected primary-expression before 'cats'
mcDesk:17: error: expected primary-expression before 'ans'
mcDesk:17: error: expected primary-expression before 'number'
mcDesk:18: error: variable or field 'digitDisp' declared void
mcDesk:18: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:18: error: expected primary-expression before 'buffer'
mcDesk:18: error: expected primary-expression before 'pos'
mcDesk:18: error: expected primary-expression before 'cat'
mcDesk:18: error: expected primary-expression before 'an'
mcDesk:18: error: expected primary-expression before 'num'
mcDesk:23: error: variable or field 'switchBars' declared void
mcDesk:23: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:23: error: expected primary-expression before 'buffer'
mcDesk:23: error: expected primary-expression before 'grphCats'
mcDesk:23: error: expected primary-expression before 'grphAns'
mcDesk:23: error: expected primary-expression before 'cmnd'
mcDesk:23: error: expected primary-expression before 'offset'
mcDesk:24: error: variable or field 'barDisp' declared void
mcDesk:24: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:24: error: expected primary-expression before 'buffer'
mcDesk:24: error: expected primary-expression before 'grphCats'
mcDesk:24: error: expected primary-expression before 'grphAns'
mcDesk:24: error: expected primary-expression before 'pos'
mcDesk:24: error: expected primary-expression before 'offset'
mcDesk:25: error: variable or field 'cBarDisp' declared void
mcDesk:25: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:25: error: expected primary-expression before 'buffer'
mcDesk:25: error: expected primary-expression before 'grphCats'
mcDesk:25: error: expected primary-expression before 'grphAns'
mcDesk:25: error: expected primary-expression before 'pos'
mcDesk:25: error: expected primary-expression before 'offset'
mcDesk:11: error: 'Adafruit_LEDBackpack' does not name a type
mcDesk:12: error: 'Adafruit_LEDBackpack' does not name a type
mcDesk:13: error: 'Adafruit_LEDBackpack' does not name a type
mcDesk:14: error: 'Adafruit_LEDBackpack' does not name a type
mcDesk:15: error: 'Adafruit_LEDBackpack' does not name a type
mcDesk.ino: In function 'void decodeCommand()':
mcDesk:193: error: 'matrixE' was not declared in this scope
mcDesk:193: error: 'ledOn' was not declared in this scope
mcDesk:199: error: 'matrixE' was not declared in this scope
mcDesk:199: error: 'ledOff' was not declared in this scope
mcDesk:204: error: 'matrixC' was not declared in this scope
mcDesk:204: error: 'cBarDisp' was not declared in this scope
mcDesk.ino: In function 'void allMatrixOff()':
mcDesk:213: error: 'matrixA' was not declared in this scope
mcDesk:213: error: 'matrixOff' was not declared in this scope
mcDesk:214: error: 'matrixB' was not declared in this scope
mcDesk:215: error: 'matrixC' was not declared in this scope
mcDesk:216: error: 'matrixD' was not declared in this scope
mcDesk:217: error: 'matrixE' was not declared in this scope
mcDesk.ino: At global scope:
mcDesk:220: error: variable or field 'matrixOff' declared void
mcDesk:220: error: 'Adafruit_LEDBackpack' was not declared in this scope
mcDesk:220: error: expected primary-expression before 'buff