Pokitto JoyHat

Ok, so I do not have the correct joystick component yet but looking Ok so far otherwise.

Even the vibration motor pads which were a bit of a guess due to bad documentation (and which i drew myself) were 100% correct

9 Likes

Everything works!

Dead simple to use:

#include "Pokitto.h"

Pokitto::Core mygame;
Pokitto::Display d;

mbed::DigitalOut jh_rumble(EXT0);
mbed::DigitalIn jh_b1(EXT15);
mbed::DigitalIn jh_b2(EXT14);
mbed::AnalogIn jh_x(EXT1);
mbed::AnalogIn jh_y(EXT2);

int main ()
{
	mygame.begin();

	while (mygame.isRunning())
	{
		if (mygame.update())
		{
			jh_rumble.write(mygame.buttons.aBtn());
			d.color = 1;
			d.printf("Joy X: %d\n",(int)(jh_x.read()*100));
			d.color++;
			d.printf("Joy Y: %d\n",(int)(jh_y.read()*100));
			d.color++;
			d.printf("B1: %d\n",jh_b1.read());
			d.color++;
			d.printf("B2: %d\n",jh_b2.read());
			d.color++;
            d.printf("A to Rumble!\n");
		}
	}
}

9 Likes

The only complaint I have is that the motor sucks the battery empty quite fast, if you spin it all the time! :wink:

Apropos, does anyone know of a open-source 1942- type game? (vertical scroller)

1 Like

Any ways to make very light vibrations so it doesn’t suck that much power?

Well, @Filmote and me worked on a 1943 game for the Arduboy…

4 Likes

I was just going to post the same link :slight_smile:

1 Like

Does sensitive rumble? Or will it need changed?

What pin did you use to drive the motor?

It turned out that its something else.

I think I will need to add a capacitor in the design to “kick” the motor or control it in a bit different way.

I can’t remember for sure, but the sensitive page say to use pins 1 and 3, so I assume pin 1 might be the positive and 3 Be pulled to gnd (just a guess right now though).

1 Like

@Vampirics beat me to it.
I keep trying to tempt @filmote over here more.

If you haven’t looked at @filmote’s GitHub yet, you should.
He’s made a whole hoard of Arduboy games.


Completely unrelated:
I find your keyboard layout incredibly interesting.

Also, Thinkpad :open_mouth: +1

I love the keyboard. What can I say.

Edit: beats the crap out of my new expensive workstation laptop (HP)

1 Like

Two player snake on “split-screen”

(a modification of @Initgraph 's Pokisnake)

GIF_1538672352723

9 Likes

@jonne

What are the resting and tilted values for the joystick?

I.e.
is xAxis.read() around 0.5f in its resting position?
is xAxis.read_u16() around 512 in its resting position?
is xAxis.read() around 1.0f in its far right position and 0.0f in its far left position?
is yAxis.read() around 1.0f in its far up position and 0.0f in its far down position?

(I want to try to get my noughts and crosses game working with the hat so you can test it.)

At the moment I’ve got most of the framework in place,
but it won’t work properly unless I know the axis values:

JoyhatNoughts&Crosses.bin (44.1 KB)

Looks like extreme fun ! Head-to-head (helmets might be needed) :slight_smile:

When can I order the hat?

Edit: Maybe someone in the community can design the 3D printable cover for it (if @jonne do not has time to do it ), when we get our hands on the PCB?

Edit2: We have a very good opportunity here at the local library. Anyone can reserve a 3D printer for four hours for 1 euro, including the materials (!).

6 Likes

I am incredibly envious.

1 Like

I had a litl go at building one, I think I have my joystick positioned wrong. With my pokitto the correct way up, pushing the joystick up, brings the Y value up and down brings it down, the Xis as I expected with left being lower than right.
Also, do the buttons get grounded, or are they raise when pressed?

[edit]
Got the joystick working in the same direction as my screen and both buttons working as well as the motor. @Pharap one of us has the joystick Y upside down, I don’t know which one of us though! Also, I think more of a dead zone is needed, when I press up/down, it has a habit of moving left/right also.

I haven’t added the i2c header to mine, I couldn’t find in the thread which way round the d and c pins are.

1 Like

The answer is: neither of us.

Take the same joystick, rotate it 4 times and you go through every possible combination of axis poles.

Sadly, this kind of thing isn’t standardised.

That’s why I want to know what the actual hat is going to do,
because that’s the standard any programs using the hat will have to go by.

That’s why I was asking for figures from the actual hat, so I could make adjustments.

If it even works, that’s just a testement to my ability to “fly blind”, because I don’t even have a mockup to work with. :P

if you can post the figures I asked for for your homemade version then I can post a bin that should work for your homemade version.

I need to know the values for read() and/or read_u16() (preferably both) for both axes at the resting position and the positions at which you think each direction should be registering.

(I’ll shove the source on a branch as well so you can tweak it if you want, though I was hoping to get confirmation that it worked on the genuine article before putting the source up.)