Step 64PC Software: Introduction
The cube just receives binary data via RS232. This data could easily be generated by a number of different programming languages, like python, perl or even php.
We chose to use C for the PC software, since the micro controller software is written in C. This way effects from the micro controller code can just be copy-pasted into the PC software.
Just like in the micro controller code, this code also does two things. Where the micro controller has an interrupt routine that draws the contents of cube[][] onto the LED cube, the PC software has a thread that continually sends data to the LED cube.
cube_pc-v0.1.tar.gz82 KB| « Previous Step | Download PDFView All Steps | Next Step » |





























































































![Hard Wired LED Cube: [No Programming]](http://img.instructables.com/files/deriv/FTD/SF1T/GO8DC8KW/FTDSF1TGO8DC8KW.SQUARE.jpg)















i can't compile them :(
My cube works fine with the usbtiny, but it doesn't work with the rs232 cable and i don't understand why?
i checked the used port (for my usb-serial cable) and used the procedure of ristdaro (on ubuntu 11.10)
I succeed to create the new file "cube" then execute it with the following command:
"sudo ./cube"
but nothing happens.
What can I do? what do I have to test and how? is that the LED on the card (rs232) should light?
Thanks in advance for your help
........ please .... help me
I will look again...
A default installation of cygwin doesn't work so I installed it full (7 GB :o).
Copy the Sources to your \cygwin\home\name folder.
Change "/dev/ttyUSB0" in cube.c in the cube_init function to e.g. "/dev/ttyS2" for COM3 in windows. Mine is a vitual com port using a uart to usb converter.
Start cygwin terminal and type "make" you should get an cube.exe which needs the cygwin1.dll in the same folder to run. You can find them in \cygwin\bin.
WARNING: To get it run, you must first make a connect to the desired com port using a terminal programm e.g. HTerm. (I have no idea why, its a workaround.)
Set the right baud rate (38400) klick Connect then Disconnect and close the terminal.
Now you can try cube.exe, best in command prompt.
If you get an error like: /dev/ttyS0: No such file or directory you set the wrong com port.
You may also note:
Masterfruit says:
sorry, havent read here for a long time... i postet the solution already somewhre else, so just the quote here:
If you are using a physical Com Port of you computer you have to add a flush command to send the data faster
add to the cube_push function in the cube.c
tcdrain(tty)
behind the write command - it should work
Install unbuntu 11.04
in terminal type the following to install:
sudo apt-get install gcc-avr
sudo apt-get install binutils-gold
sudo apt-get nautilus-open-terminal
i used a prolific usb-serial cable
checked that comms pointing at usb0 or usb1 with command 'dmesg'
if pointing at wrong port change cube.c and re-compile
open source folder cube_pc in terminal and type ;make'
copy the newly created file 'cube' to nautilus terminal window
worked perfectly for me!
I have made cable and have rs232 port but now i need code for windows...
Thanks in advance
Did you ever get the code to work in windows using winavr?
Have any bright sparks out there managed to successfully get the software to run in winavr - windows xp without using unbuntu?
However, i don't have any understanding of coding in any language nor have i ever programmed any ic or chip or whatever.. this was my first project with an atmel chip.
Apparently its easy to compile the RS232 code provided by chr in linux... just "make" and the executable is done - as long as you have something like an usb to serial dapter.. i dont know exactly what this function
char *tty_path = "/dev/ttyUSB0";
exactly means, but i think its calling somekind of this adapter (and thats where im stuck now)
But I'm running on a win xp machine, so i had to compile here... i had the same problem as you and 'mist egal'.. the gcc compiler seems to have some glitches, bugs... whatever in windows.
so i tried the hint of a friend and installed cygwin.. a console-program that allows you to start a linux console under windows with lots of plugins in it. i finally managed to compile the program, yes i have a cube.exe, but now i'm stuck on the adapter thing (Running it I get an error in win saying
/dev/ttyUSB0; No such file or directory
I'd like to run the RS232-Mode in windows, but my friend told me also that it would be a hell of a code for win to use my serial port (COM1) to work with the cube
even if i'd install now linux on my machine i think iwill still stuck on the USB-Serial-Adapter-thing
so any suggestions here? if not, i'll leave the rs232 part of this instructable.... the cube is also awesome standing alone and making effects. :-D
P.S. I have also recognized that the code for the font-effects on the atmel cpu is mixed up a bit... if i compile the code for myself the fonts, bitmaps etc are just displayed as blocks. i managed to get the font to work, but at least im stuck at the bitmaps (for example the arrow moving around or the omega-symbol rotating appear correctly) if this is also a windows thing let me please know ;-)
I assume you can go into the control panel and look up the name of the usb port in windows in a similar way!
i just had to link the virtual serial port (ttyS0) with the COM1 of my windows machine, compile the code in Ubuntu again and run it.
The only problem i now have that the connection between Virtual Box serial output and the hardware serial output is messed up a bit... i get only an effect picture every two seconds on the cube.. have to look into that this evening.;-)
P.S. you'll also have to change the wires of the RX/TX pins... 'troller1' described this before
If you are using a physical Com Port of you computer you have to add a flush command to send the data faster
add to the cube_push function in the cube.c
tcdrain(tty)
behind the write command - it should work
"gcc -lpthread -lm -o cube main.c cube.c draw.c effect.c font.c 3d.c draw_3d.c gameoflife.c"
in the main folder where the files are. a file named "cube" should be generatet. if executet, it should feed the cube via
" char *tty_path = "/dev/ttyUSB0"; "
with data. if youre using a physical com-port, change it in the cube.c to ttyS0 or ttyS1 whatever port you are using. chr seem to have used an usb-to serial adapter fo this.
Compiler: Default compiler
Building Makefile: "D:\cube_pc\Neuer Ordner\Makefile.win"
Executing make...
make.exe -f "D:\cube_pc\Neuer Ordner\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
g++.exe -c ../3d.c -o ../3d.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
../3d.c: In function `void linespin(int, int)':
../3d.c:46: error: `line_3d' undeclared (first use this function)
../3d.c:46: error: (Each undeclared identifier is reported only once for each function it appears in.)
../3d.c: In function `void sinelines(int, int)':
../3d.c:76: error: `line_3d' undeclared (first use this function)
../3d.c: In function `void fireworks(int, int, int)':
../3d.c:220: warning: passing `float' for converting 1 of `void setvoxel(int, int, int)'
../3d.c:220: warning: passing `float' for converting 2 of `void setvoxel(int, int, int)'
../3d.c:257: warning: passing `float' for converting 1 of `void setvoxel(int, int, int)'
../3d.c:257: warning: passing `float' for converting 2 of `void setvoxel(int, int, int)'
../3d.c:257: warning: passing `float' for converting 3 of `void setvoxel(int, int, int)'
make.exe: *** [../3d.o] Error 1
Execution terminated
I dont understand about kompiling etz i have tryed about one week succsessless anyway!
Is there a executable file?
how did u manege make file???
So i only type "make" to crete the flashfiles
for me the best solution
Hm..maybe cygwin works!
system cannot find the file specified
make: *** {cube} Error2
I can show you how to write routines that are 100s of times faster than C. I can also debug the routines while they run.