~ Project BlackBox ~
+4
Tuff Tiga
Christmas
Inhaps
Gecko
8 posters
Page 1 of 1
~ Project BlackBox ~
So I was chilling Xmas knows whats up. And while I was pondering I came up with an amazingly fantastic plan of awesomeness. I will make me a coffee table. "A coffee table?!?" you say, "But, how is that programming?" Well quiet the plop up and I will describe. While pondering I thought, "Who doesn't love the classics?" Of course you say, "No one!" I have taken this into account! So let me present the idea!
Retro Game Table!!!!!!
~BrickBreaker
~Pong
~Tetris
~Snake
~Space Invaders
~Flobbin' Simon!
This table is all. 32 x 32 LED display 1024 seperate LED's 3 different colors equaling 3072 LED's. But the coolness doesn't there. 192 74HC595 BitShift registers 3 Arduino Mega's and Retrograde Controllers!
How you may ask is this programming? Well if you know anything about Arduino, is that it is a microcontroller. Fancy term for tiny computer. I am programming, designing and building this table. I plan on updating every few days so check back for awesomeness!
ETA: August 30th
Currently owned:
~200 bitshift registers, Cost: $60
~200 DIP 16pin mounts, Cost: $15
~1200 RGB Common Cathode LED's, Cost: $70
~1 Arduino Mega, Cost $75
~1 Sheet of Acrylic, $21
~5 PCB's(Prototypes) $47
Total Cost: $288
Not cheap at all... But globbin' AWESOME!!!
Table of Contents:
1.0 - Intro
1.1 - C Header Files
1.2 - C Source Files
1.3 - Newly learned Programming Concepts
1.4 - Physical Table Progress
Retro Game Table!!!!!!
~BrickBreaker
~Pong
~Tetris
~Snake
~Space Invaders
~Flobbin' Simon!
This table is all. 32 x 32 LED display 1024 seperate LED's 3 different colors equaling 3072 LED's. But the coolness doesn't there. 192 74HC595 BitShift registers 3 Arduino Mega's and Retrograde Controllers!
How you may ask is this programming? Well if you know anything about Arduino, is that it is a microcontroller. Fancy term for tiny computer. I am programming, designing and building this table. I plan on updating every few days so check back for awesomeness!
ETA: August 30th
Currently owned:
~200 bitshift registers, Cost: $60
~200 DIP 16pin mounts, Cost: $15
~1200 RGB Common Cathode LED's, Cost: $70
~1 Arduino Mega, Cost $75
~1 Sheet of Acrylic, $21
~5 PCB's(Prototypes) $47
Total Cost: $288
Not cheap at all... But globbin' AWESOME!!!
Table of Contents:
1.0 - Intro
1.1 - C Header Files
1.2 - C Source Files
1.3 - Newly learned Programming Concepts
1.4 - Physical Table Progress
Last edited by Gecko on 20/8/2014, 2:38 am; edited 6 times in total
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
So what I have here is theoretically a library... theoretically. It is set up like one, but it actually follows the practice of a framework. This is making it way easier, without a framework every time I wanted to write a single led, I would have to put:
Why?, you may ask. Well, its the only possible way. Humans think in a linear pattern, and much to that trend so do our programming languages. C++ is no exception, well sort of. You can multi-thread which is the option of using many CPU cores, that would be awesome and perfect to do on Arduino, except it only has one CPU core so I can only write one pin at a time... but that's fine in fact computers that have one CPU core seem to run many things at one time.. why? Becuase humans are flobbin' awesome, my Arduino Mega has a 16 MHz CPU, that is 16,000,000 calculations per second. So only one led is ever on at a time, but who cares.
- Code:
for(int i = 0; i < 8; i++)
{
digitalWrite(latch, LOW);
shiftOut(data, clock, LSBFIRST, dataSent);
digitalWrite(latch, HIGH);
}
Why?, you may ask. Well, its the only possible way. Humans think in a linear pattern, and much to that trend so do our programming languages. C++ is no exception, well sort of. You can multi-thread which is the option of using many CPU cores, that would be awesome and perfect to do on Arduino, except it only has one CPU core so I can only write one pin at a time... but that's fine in fact computers that have one CPU core seem to run many things at one time.. why? Becuase humans are flobbin' awesome, my Arduino Mega has a 16 MHz CPU, that is 16,000,000 calculations per second. So only one led is ever on at a time, but who cares.
- ambient.h:
- Code:
#ifndef AMBIENT_H
#define AMBIENT_H
#endif
- brickbreaker.h:
- Code:
#ifndef BRICKBREAKER_H
#define BRICKBREAKER_H
#endif
- input.h:
- Code:
#ifndef INPUT_H
#define INPUT_H
class input
{
public:
bool StartIsPressed(int player);
bool UpIsPressed(int player);
bool DownIsPressed(int player);
bool RightIsPressed(int player);
bool LeftIsPressed(int player);
bool AIsPressed(int player);
bool BIsPressed(int player);
};
#endif
- led.h:
- Code:
#ifndef LED_H
#define LED_H
enum ledColor{Red, Green, Blue, White};
class Graphics
{
public:
void ComposeFrame();
void PutPixel(byte x, byte y, ledColor color);
void WriteBoard(bool pixel[]. ledColor color[]);
void LedTest();
private:
bool pixelArray[];
ledColor pixelColor[];
};
#endif
- maze.h:
- Code:
#ifndef MAZE_H
#define MAZE_H
#endif
- music.h:
- Code:
#ifndef MUSIC_H
#define MUSIC_H
#endif
- pong.h:
- Code:
#ifndef PONG_H
#define PONG_H
#endif
- simon.h:
- Code:
#ifndef SIMON_H
#define SIMON_H
class Simon
{
public:
void PlaySimon();
private:
bool StartSeq();
bool ColorBoard();
bool WinCheck();
};
#endif
- snake.h:
- Code:
#ifndef SNAKE_H
#define SNAKE_H
#endif
- spaceinvader.h:
- Code:
#ifndef SPACEINVADER_H
#define SPACEINVADER_H
#endif
- startup.h:
- Code:
#ifndef STARTUP_H
#define STARTUP_H
#endif
- stdafx.h:
- Code:
http://stdafx.h
#ifndef STDAFX_H
#define STDAFX_H
#include "Arduino.h"
#include "startup.h"
#include "led.h"
#include "input.h"
#include "maze.h"
#include "music.h"
#include "pong.h"
#include "screen.h"
#include "simon.h"
#include "snake.h"
#include "spaceinvader.h"
#include "tetris.h"
#include "ambient.h"
#include "brickbreaker.h"
#endif
- tetris.h:
- Code:
#ifndef TETRIS_H
#define TETRIS_H
#endif
Last edited by Gecko on 20/8/2014, 2:53 am; edited 5 times in total
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
- led.c:
- Code:
#include "led.h"
bool Graphics::pixelArray[32 * 32];
ledColor Graphics::pixelColor[32 * 32];
void Graphics::ComposeFrame()
{
byte ledArr[16] = {0b10000111, 0b10001011, 0b10001101, 0b10001110,
0b01000111, 0b01001011, 0b01001101, 0b01001110,
0b00100111, 0b00101011, 0b00101101, 0b00101110,
0b00010111, 0b00011011, 0b00011101, 0b00011110}; //Intialize binary array for outputting to the led's as needed
for(byte secy = 0; secy < 8; secy++) //This is the first part of breaking down the massive array, into an understandable format
{
for(byte secx = 0; secx < 8; secy++) //See above note
{
byte curSec[16]; //Intialize an array to temporarily store each led sections led values
ledColor curSecC[16]; //See above, except storing color
byte index = 0; //This is so I can convert the virtual 2d array into a single dimension
for(byte y = 0; y < 4; y++) //Get the y value in each section
{
for(byte x = 0; x < 4; x++) //Get the x value of each pos such as Section 18 spot 3, 2
{
curSec[index] = pixelArray[(x + (secx * 4)) + ((y * 32) + (secy * 4)); //Final full vitrual 2d to single dimesion
curSecC[index] = pixelColor[(x + (secx * 4)) + ((y * 32) + (secy * 4)); //See above except with color array
index++;
}
}
for(byte i = 0; i < 16; i++) //Goes through the 16 part section to check for led's
{
if(curSec[i] == 1) //Executes code if there is an led that needs lit
{
digitalWrite(latch, LOW); //Drop the latch for data transfew
digitalWrite(curSecC[i], HIGH); //Open color gate for that led's color
shiftOut(data[secx * secy], clock, LSBFIRST, ledArr[i]); //Send the Led Location Data
digitalWrite(curSecC[i], LOW); //Close the color gate
digitalWrite(latch, HIGH); //Close latch to display data
}
}
//Move onto next section
}
}
digitalWrite(red, HIGH);
digitalWrite(green, HIGH);
digitalWrite(blue, HIGH);
for(int i = 0; i < 1024; i++)
{
if(i < 64)
{
shiftOut(data[i], clock, LSBFIRST, 0b00000000);
}
pixelArray[i] = 0;
pixelColor[i] = 0;
}
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
}
void Graphics::PutPixel(int x, int y, ledColor color)
{
pixelArray[x + (y * 32)] = 1;
pixelColor[x + (y * 32)] = color;
}
void Graphics::WriteBoard(bool pixel[])
{
for(int i = 0; i < 1024; i++)
pixelArray[i] = pixel[i];
}
void Graphics::LedTest()
{
}
- ambient.c:
- Code:
#include "ambient.h"
- brickbreaker.c:
- Code:
#include "brickbreaker.h"
- input.c:
- Code:
#include "input.h"
- maze.c:
- Code:
#include "maze.h"
- music.c:
- Code:
#include "music.h"
- tetris.c:
- Code:
#include "tetris.h"
- startup.c:
- Code:
#include "startup.h"
- spaceinvader.c:
- Code:
#include "spaceinvader.h"
- snake.c:
- Code:
#include "snake.h"
- simon.c:
- Code:
#include "simon.h"
void PlaySimon()
{
StartSeq();
ColorBoard();
while(WinCheck() == true)
{
}
}
bool StartSeq()
{
}
bool ColorBoard()
{
int section[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
for(int y = 0; y < 16; y++)
{
for(int x = 0; x <
}
bool WinCheck()
{
}
- screen.c:
- Code:
#include "screen.h"
- pong.c:
- Code:
So I lied, there is this mode, but my friend is doing pong and another hidden file at the moment, so I can't post this code, as I literally do not have it... yet, but actually, more of this game is done than any other, mostly because I have been only doing the barebones.
Last edited by Gecko on 20/8/2014, 2:49 am; edited 2 times in total
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Classes:
~These are newly learned concept to me and are really awesomely awesome. A class easily allows me to, rather than having any function be used anywhere and making overloading a function confusing, I can just call gfx.PutPixel(x, y, TRUE); This also allows me to keep functions that are only needed for certain function, only to be used by those functions.
BitWise Operators:
~Up until this project, I never really understood these, and the little knowledge I did have about them was questioning why I would ever need it. But I will give a small example of why these are helpful.
~The way the shiftOut(); function works with the 74HC595 shift register is as follows. shiftOut(dataPin, clockPin, LSBFIRST/MSBFIRST, byteToSend);
-dataPin - Pin on which Information will be sent.
-clockPin - Pin that tells the receiver when a bit is ready to be read.
-LSBFIRST - Tells that the bit starting at 1 then 2, 4, 8 are to be sent in that order.
-MSBFIRST - Same as above but starting at the high end to the low end.
-byteToSend - That is where the bitwise help comes in, That is the Binary representation of the data
~So my example is, imagine I have an led 10000111(top left in the multiplexer) and I need to keep it on but then I need to turn on the 3rd led there are a few ways I could do this, one is I could bitwise OR 10000101 and 00100101, this would make 10100101, but then there are some problems that I'll put in later, because Oh My Glod is this explanation really long...
BareBones:
~Not really a whole thing in itself, I have just been learning some really close to the cpu programming. This led is running so flobbin' fast it's ridiculous. Like honestly 16million calculations per second, the really ridiculous thing is, that some things I have done to improve operation have only shaved nanoseconds off, but have seen major improvement because of such. This brought in a new library which is just a re-write of the already existing main arduino library, but rather than typing out
The first set of code(digitalWrite()) takes 6.8microseconds
The second set of code takes 1.4 microseconds!
Thats not a whole lot until you think that just to write the led board it has to cycle through 1024 leds *without you being able to see them turn off* and process the game/input. Infact I will post a video demonstration of the difference. Note: It is one led right now, and represents the difference between the first led and the last led.
~These are newly learned concept to me and are really awesomely awesome. A class easily allows me to, rather than having any function be used anywhere and making overloading a function confusing, I can just call gfx.PutPixel(x, y, TRUE); This also allows me to keep functions that are only needed for certain function, only to be used by those functions.
BitWise Operators:
~Up until this project, I never really understood these, and the little knowledge I did have about them was questioning why I would ever need it. But I will give a small example of why these are helpful.
~The way the shiftOut(); function works with the 74HC595 shift register is as follows. shiftOut(dataPin, clockPin, LSBFIRST/MSBFIRST, byteToSend);
-dataPin - Pin on which Information will be sent.
-clockPin - Pin that tells the receiver when a bit is ready to be read.
-LSBFIRST - Tells that the bit starting at 1 then 2, 4, 8 are to be sent in that order.
-MSBFIRST - Same as above but starting at the high end to the low end.
-byteToSend - That is where the bitwise help comes in, That is the Binary representation of the data
~So my example is, imagine I have an led 10000111(top left in the multiplexer) and I need to keep it on but then I need to turn on the 3rd led there are a few ways I could do this, one is I could bitwise OR 10000101 and 00100101, this would make 10100101, but then there are some problems that I'll put in later, because Oh My Glod is this explanation really long...
BareBones:
~Not really a whole thing in itself, I have just been learning some really close to the cpu programming. This led is running so flobbin' fast it's ridiculous. Like honestly 16million calculations per second, the really ridiculous thing is, that some things I have done to improve operation have only shaved nanoseconds off, but have seen major improvement because of such. This brought in a new library which is just a re-write of the already existing main arduino library, but rather than typing out
- Code:
digitalWrite(13, HIGH);
digitalWrite(13, LOW);
//I can instead use
GPIO_PORT_REG(pin) &= ~GPIO_PIN_MASK(pin);
GPIO_PORT_REG(pin) |= GPIO_PIN_MASK(pin);
The first set of code(digitalWrite()) takes 6.8microseconds
The second set of code takes 1.4 microseconds!
Thats not a whole lot until you think that just to write the led board it has to cycle through 1024 leds *without you being able to see them turn off* and process the game/input. Infact I will post a video demonstration of the difference. Note: It is one led right now, and represents the difference between the first led and the last led.
Last edited by Gecko on 5/8/2014, 5:25 am; edited 2 times in total
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
So this is all the physical progress on the table, not a whole heck of a lot, but honestly $226 USD on the electronics... not that I don't have the money, but dropping $500 USD in one weekend is not my ideal start, so after I have gained an untold amount of money is when the table will start being thrown together, probably mid-August so I can use my school's shop class.
- Table:
Last edited by Gecko on 1/8/2014, 6:51 pm; edited 1 time in total
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
That sounds like a pretty fun project. Looking forward to you going through with it.
Inhaps- Grandmaster (2000 posts)
Re: ~ Project BlackBox ~
This is going to be amazing!! I cant wait to see the progress and how it finally turns out!!
Christmas- Grandmaster (2000 posts)
Re: ~ Project BlackBox ~
Awesome that you're using C So looking forward to this
Tuff Tiga- Grandmaster (2000 posts)
Re: ~ Project BlackBox ~
- Spills his drink, table is ruined -
Very nice idea really awesome.
Please post a photo when it's finished
Very nice idea really awesome.
Please post a photo when it's finished
Mr Rockeye- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
For Mr Rockeye, this is a full log , so yes, there will be plenty of pictures of the all the steps. Also 'twill be sealed, I have yet to decide a sealant, but I have shellac, and lacquer is fairly cheap, well compared to the rest of the table.
For Inhaps and Xmas, thanks guys, there are a couple features unlisted, but those will be some of the cooler ones.
And Tiga, first use I will actually have of bitwise logic XD. Here is a picture of the source folder, crazy colorful XD, but honestly with my computers awesome stats compiling can take a few seconds, on simple code, so I expect the compiling on this to take a little while, but then thats the point of a stdafx.h XD
And this is roughly what the table will look like.
For Inhaps and Xmas, thanks guys, there are a couple features unlisted, but those will be some of the cooler ones.
And Tiga, first use I will actually have of bitwise logic XD. Here is a picture of the source folder, crazy colorful XD, but honestly with my computers awesome stats compiling can take a few seconds, on simple code, so I expect the compiling on this to take a little while, but then thats the point of a stdafx.h XD
- Source Folder:
And this is roughly what the table will look like.
- Table:
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
This sounds pretty amazing, i am curious to see how this will turn out since i have never heard of anything like this being done before.
RedRaven- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Nice man, keep it up, looking forward for future updates!
Imperfectpur- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Hmm... forgot to make a post for this so here are some pictures. Scale of insanity 1 - 100. 9001!
- DIP Mounts:
- RGB LED's:
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Update again, I have decided to etch my own printed circuit boards. Total cost of $170...
- Circuit Layout, Top Half on Left:
- NEW Circuit Layout:
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
UPDATE:
So Funk making my own circuit boards, that is flipping insane, at least on the scale and complexity I need so I'm ordering them for the same price from Seeed.
Should be receiving my first 5 prototypes in the next 15 days. At that point if I make one up and it works correctly I'll be ordering 100 more... The prototypes are red, so I will post a picture.
Wood work is going to start in the near future. Not looking forward to that craziness. As well I will actually be making a full tutorial on this for anyone interested on Instructables, to enter into a tech contest.
So Funk making my own circuit boards, that is flipping insane, at least on the scale and complexity I need so I'm ordering them for the same price from Seeed.
Should be receiving my first 5 prototypes in the next 15 days. At that point if I make one up and it works correctly I'll be ordering 100 more... The prototypes are red, so I will post a picture.
Wood work is going to start in the near future. Not looking forward to that craziness. As well I will actually be making a full tutorial on this for anyone interested on Instructables, to enter into a tech contest.
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
It has been 4 days, status of PCB orders changed to processing. Bought new soldering equipment, and a few prototyping resistors and diodes.
EDIT: Status has been changed to shipped. Really quick turn around.
EDIT: Status has been changed to shipped. Really quick turn around.
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
UPDATE: My prototype circuitboards will arrive today, if they pass my test 100 more will be ordered. I will upload a video of the test when I assemble one.
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Received my second prototypes... they don't work... But I have a new design about to be ordered that should work perfectly(I have tested it)
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Starting actual construction on table in the next few days. Have to work a few more days and get some more money.
Gecko- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
This looks like a really unique project. Can't wait to see how it turns out.
kalio- Tier 4 (500 posts)
Re: ~ Project BlackBox ~
Chinese holidays... severely delayed my new circuit boards... so it'll be a few more days before I can even start most of the soldering >.>
Gecko- Tier 4 (500 posts)
Similar topics
» ~ Project: Bio ~
» Opening of the PvM Project!
» Smokin PvM Project Drop Log!
» Ace's and Valinxh's crib... [ONGOING PROJECT]
» My current team-build project!
» Opening of the PvM Project!
» Smokin PvM Project Drop Log!
» Ace's and Valinxh's crib... [ONGOING PROJECT]
» My current team-build project!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|