Some digispark boards need to have its higher fuse programmed so the RESET pin can work as an I/O pin. That procedure can be done using another arduino board. (link) or using (USBasp) (clones will do fine too).
Srandard Paddle mode is providing a positive pulse from 12.125us to 3058us just like the specification in Red Book (details).
The pdl(1) function return values in the range of o to 255 with just a bare deadzone at the end (full clockwise). Here is a demonstration (video) using a BASIC Program.
Worth to mention that the Digispark board spends a few seconds after powered up doing its bootloading process. After that it starts to execute the main paddle code. (video)
Here is a couple of pictures of the working prototype.
Now that all everything is working, the operating modes, the programming features and even the automatic detection, I can call it a day and conclude this project. Time to move on to other stuff.
I really hope you all can enjoy it, build your own to play Arkanoid and Galaga and even better, enhance the code to add more features.
Are you trying to troll me? You won't succeed.
I could have a technical argue about either solution but I won't waste my french with that matter.
The potentiometer provides instantaneous response, and that's all I have to say.
Be easier, talking about such things, I will not prove anything since you behave this way.
Do what you think is necessary, since you want to spend your time in vain, on such attempts.
Browsing another topic on this forum I came across some of your posts and suddenly I realized that you are not a native english speaker.
Knowing that I read again your last posts here and think I must have interpreted your words wrongly tooking them as a provocation.
Sorry about that!
Let's leave this behind us and start over, ok?
Sorry about that!
Let's leave this behind us and start over, ok?
Np, and yes, english is not my native, better for me is only chinese
So what I told before:
All stationary game automats with arcanoid what I seen (mostly FC may be, idk), uses rotary encoders (device like potentiometer, but with infinity rotations, and return not resistance, but impulses).
And when I seen Pro gamers, who playing it forever, they rotate it so fast that he made buzzing sounds and pad movements was with tremendous speed!
If you interesting, I have my own simples but effective interrupt code for AVR, reading encoder.
But I guess, if you want made something simelar, you need create something like software inertial system.
PS: Btw, this rotary encoder was also in Penguin Wars automat, and horizontal shooter like a Nemesis (rly dont remember nothing more).
Thanks to share this nice project.
Can the joystick port supply enough current for the Arduino Nano?
Arcade machines had to be designed to endure thousands of hours of hard work, hence the use of a potentiometer is out of question for games involving a rotary knob.
Rotary encoders suits very well for such application, and even the early models made with physical contacts have a service life longer that any potentiometer.
Besides their high reliability, ordinary rotary encoders have a low angular resolution (Counts per Revolution) which requires a lot of turn to provide large number of steps. That is the reason why they have a flywheel attached. The flywheel allows the shaft to turn several times very quickly, and the user only have provide the initial impulse and let inertia do the rest.
Of course high resolution encoders are available but yet today they are not cheap.
The potentiometer on the other hand is a simpler solution in the sense that it requires less components (electrical and mechanical) and that brings the benefit of low cost, being the solution used by Taito on its consumer grade controller, but it also have its flaws, mainly long term endurance and friction (though the pot used by taito is smoothier than regular ones)
In terms of man-machine interaction both solutions are equivalent, the difference in handling is a mere trade between mastering Inertia or Friction and a person can train itself to be effective in either.
Your code is welcome, of course. I've been wondering about how to overcome the low CPR of a cheap rotary encoder by using the rate of change innstead of simply counting the steps, and this is pretty much the solution used on PC mice.
Thanks to share this nice project.
Can the joystick port supply enough current for the Arduino Nano?
You welcome!
I have measured the current of the circuit with Digispark (~20mA) and UNO (~40mA).
A nano board should sink around 40mA. It is fine for the Joystick port.
#define _enB 2 #define _enR 4 #define _enL 8 register volatile uint8_t _enc_state asm("r6"), _pB asm("r8"), _storB asm("r9"); ISR (PCINT0_vect) { _pB = PINB & ( _enL | _enR | _enB ); _enc_state = ((_pB & _enB)!=0)?(((_pB&_enR)<<1)^(_storB&_enL))|(((_pB & _enL)>>1)^(_storB & _enR)):_enB; _storB = _pB; }
Interrupt return only direction flags, or button like:
0b0000LRB0, where:
L - Left
R - Right
B - Button
For pulses counter, needed second timer interrupt, for counting repeated states inside period.
AVR able do it very fast.
So you will:
When encoder pulse coming, you will start timer interrupt (or any another period counter),
And inside period check, if dirrection was changed, reset period counter to 0.
Else - increment counter, and this counter mean amount of repeated pulses inside period.
Ofc you might create another system.
PS: register keyword is deprecated from C'11.
Thanks for sharing the code.
As the rotary encoder requires two pins the configurable device (standard/vaus) would only be possible with nano/Uno.
To avoid issues with compiler the register variables can be replaced by memory.
I don' t think that interrupt concurrence should be critical for this application (wr still have to serve the MSX requesting Clock pulses and SOC) but it is better todeclare the interrupts as __NAKED.
Thanks.... Very Great Job....
This is my first version of Arkanoid Reply Case....
That looks damn good!