Im trying to figure some stuff out to learn programming for the Pokitto. However i dont know sh*t about C++
I have been fooling around in this code :
#include "Pokitto.h"
Pokitto::Core mygame;
Pokitto::Core pokitto;
int main () {
mygame.begin();
while (mygame.isRunning()) {
if (mygame.update()) {
mygame.display.print("Aylana");
if(pokitto.buttons.aBtn())
{
// change the name as long as button is pressed
mygame.display.clear();
mygame.display.print("Alexander");
//playTone (1, 2, 2, 5, 5);
}
}
}
}
Could someone tell why buttons can only be used if i add Pokitto::Core pokitto; ? Is this not something the #include pokitto.h does already ?
And what should i use for just making it beep? Playtone is not defined according to the mbed compiler. Or do i need another reference for that ?
A ok, so i removed the pokitto::core mygame and got errors all over.
But this helped, i now understand that the name after pokitto::core is linked. So every command should start with that name.
But what about the sound? Is there something that fits into 1 line to generate a tone or a beep ?
I need to get back to you on the sound, my attention is split among several things at the moment.
You can also do this with ll the different “subsystems”:
#include "Pokitto.h"
Pokitto::Core mygame;
Pokitto::Buttons bttn;
While (mygame.isRunning()) { ... and so on
if (bttn.aBtn()) { .... and so on
Pokitto::Buttons bttn will be pointing inside mygame object structure - in fact it will be the same thing as mygame.buttons! This is a trick you can use to shorten the amount of code you need to write and it does not cost you any extra memory!
aha it does work! but for some reason it is very soft. I could only hear it with a headset and on the max volume.
Using the the speaker of pokitto itself i think i hear something, but im not sure.
Making sure the speaker does work i tried the test animation, and that works good.
edit: could it be the sound volume has to be set in software as well ?
So even running text.bin from the game page I linked to above you hardly hear the sound at all? Because it works fine on my Pokitto… if that is the case then I would begin to suspect a hardware fault?
No, lets be clear here. The speaker from pokitto is working.
If i use the animation test i can hear the feelgood sound.
However this is not very loud, but perhaps that is just the soundlevel/volume the pokitto can produce.
If i use the text.bin i cannot tell if pokitto is making a sound or not.
Using a headset and setting the volume to max i can here te beep in the game.
So sound is working, but i am expecting it to be a little louder.
And as a extra i have to set the max soundlevel everytime i boot. Since pokitto doesnt make a hearable sound on the lower levels, i have to set this to the max 255. Then after starting the game i set it to higher volume.