Go Down

Topic: Convert 8x8 code into 4x4 code? (Arduino Uno) (Read 360 times) previous topic - next topic

mavkor

I am wondering if it would be possible to convert the code from this link (8x8 code for the game stacker)
into a code for a 4x4 matrix)
Original Code : http://kevin.mcmill.in/does/stacker.ino


This is on the Arduino Uno (pic of the wiring)
https://gyazo.com/c0baaad7b7154644c76411da880de134

Here is what i have edited it to so far
https://docs.google.com/document/d/1hV9j0mRfbtuUjb9huKQk1jVsqAGiRiTKnQnOHN5QZIk/edit?usp=sharing
and what happens with the first level for starters is that the led on the last column does not light up but it should be going over to a fourth column because on the furthest most left side it takes a little longer before getting back. Any help with adjusting the code to work with 4x4 would be nice.

mavkor

Could anyone help me write a code just like how this stacker game works, https://www.youtube.com/watch?v=32B5cWlFr04

but for a 4x2 led matrix with pins (8,9,10,11) for columns
pins (2,3) for rows
pin 4 for a switch
and pins (5,6,7) for levels

any help would appreciated and i could even pay you for the help.

Coding Badly


GoForSmoke

#3
Jan 10, 2016, 09:16 am Last Edit: Jan 10, 2016, 09:18 am by GoForSmoke
One color leds? Just checking.

When you multiplex leds, only so many can be lit at any one moment. The best you can do is try and get the leds all to the same brightness with extra code.

If you connect the 16 leds to 2 output shift registers (2 8-bit chips or 1 16-bit) then you can pump 2 bytes into them to set every led as desired up to full bright about 100 or so times faster than you can see.

As to which leds to light and the whole game thing, you should probably define in detail how you want every action possible to take to work out. Don't start coding until you have a solid plan.

Buttons, I'd multiplex. Even wrote code for it. Buttons are human-slow except for the bounce.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Go Up