Author Topic: Mini/Micro Game System  (Read 8120 times)

MrDubstepWarMachine

  • Newbie
  • *
  • Posts: 1
Mini/Micro Game System
« on: July 20, 2014, 05:57:21 am »
Hi guys, I've been thinking. Really thinking. I recently found my Digispark (they're so small!) and decided to put it to use. I have always wanted to have/build something like a micro gaming system (sort of like the ben nanonote (if you don't what that is, google it, its really cool)) and decided that as a challenge, I could try implementing the Digispark as the Processor. I know that I wouldn't be able to run any games more advanced than pong, breakout or snake, but even those kinds of games would be enough to keep me interested while in boring situations. My basic thinking is this: There would a small lithium-ion rechargeable battery on the bottom to be a base (but still removable), the Digispark without any headers above the batteries, and a small LCD screen (1.8, 2 or 1.3 inch screen size) that would have either two pushbuttons (one on either side of the screen) or four pushbuttons configured in a D-pad style on the right side of the screen (how many buttons it would have depends on how many pins the Digispark would have open (if any), which also leads to my question, does anybody know any place to get video LCD screens (don't care if its color or not) that only take up 4 or less pins? I know that probably seems absurd, but if anybody knows any places to get them, please let me know. And just one last thing, is it possible to program games in the arduino IDE? Are there libraries for them? ANd if you can program games, just how advanced can you go?

MichaelMeissner

  • Full Member
  • ***
  • Posts: 166
Re: Mini/Micro Game System
« Reply #1 on: July 20, 2014, 02:16:59 pm »
If you get an i2c screen, you can hook up the i2c bus on your digispark.  Get the i2c lcd shield PCB (http://digistump.com/products/21), and two 4.7K ohm resistors to enable the i2c bus on your digispark (you could get the entire lcd kit, but that lcd is a text only lcd).

Then you can get an i2c display to the shield.  Note, you have to be careful about which board you get, because the digispark has limited memory (the oled displays for instance have to have the enire screen in memory, and the spark just doesn't have enough).  When you get the code for the display, you may have to modify it to use TinyWireM.h instead of Wire.h.

I prefer the dig-ole OLED displays.  These displays have the processor on the display, so you only need to issue commands via i2c to the display.  http://www.digole.com/index.php?categoryID=153

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Mini/Micro Game System
« Reply #2 on: July 20, 2014, 06:35:59 pm »
Just looked at this no OLED and indeed it does offload much of what is in the library noted below: http://www.digole.com/index.php?productID=844

I've been working with an I2C 128x64 OLED library for the Pro.  It has no buffer and fits in the RAM - but the code for minimal text and graphics hits 10.4K - and it has IFDEF to drop out some code (multiple font sizes) and it still hits 7.5K, so that alone even if pared down to fit would fill the Digispark code space.  You could get somewhere with the PRO's larger code space and hopefully have a couple hundred bytes RAM to use - but I haven't pushed that so I'm not sure how much the library eats that may not show up in the Compile RAM summary - currently 162 bytes.

My OLED port to PRO is working well - current text and graphics loop() has cycled 22,233 times (44 hrs) since I last uploaded and powered it up on USB battery and seems stable.  It has one screen column on the right margin that can be written to but not cleared, this behavior is not that way on my UNO so there is something compiling differently - or running differently for PRO.  Digistump considering this library for the PRO OLED - Text only he was looking at was not this far along and offered no sprite support.

The good news is Digistump pointed out the one pin conflict that was messing with PRO USB - and after running most of two days - it plugged right back in and took code again using the updated bootloader I had to flash after hosing it last time.
« Last Edit: July 20, 2014, 09:55:31 pm by defragster »

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Mini/Micro Game System
« Reply #3 on: July 20, 2014, 09:16:57 pm »
Pushed RAM from 162 bytes to 422 and it works.  Adding another 20 bytes and it dies shortly after starting when the upload says 442 dynamic memory.  USB device goes unknown and execution halts or freezes then restarts.  Both the small 7k and larger 10k libraries act about the same.  I assume the 'reserved' 80-90 bytes goes to the system somewhere - maybe Digistump can shed light on this - this is PRO related and should end up under PRO