Hi fellow Bittle and Nybble owners !In this new post I will continue to analyse the code of opencat and today I want to explain the IR remote part of the code.
As a reminder, you can add motions and postures to your robot by writing the data in the instinct header file into the WriteInstict folder, once again this part is well documented in the manual at : https://bittle.petoi.com/8-teach-bittle-new-skills.As said in the manual, you can modify an already existant motion like the "zero" motion, it's an easy way to add a skill to your robot as you will just have to push the button assigned to the "zero" skill (the 9 button by default) to make it run by your robot.But you will surely want to teach more than one skill to your robot so I will show you how to change the IR remote buttons assignment.Everything happens in the opencat.h file, here you can find the "macros" that defines the assignment.Macros are text substitution that happen at the code compilation time (it happen when you upload the code into your robot), all you have to know here is that they are defined by the well named '#define' keyword at the line 142:
To add a new skill assignment you can simply comment (it do not take memory) the old assignment and replace it by yours like that:
//old assignment is commented out and so not interpreted by the compiler//#defineK61"sit" //sit#defineK61"mySkill" //my awesome new skill
And that's all ! if you have defined correctly the new skill with that name on the "teach a new skill" part of the documentation, you will just have to push the right button (here the 8 button) to make your robot run your new skill.I hope having explained well but don't hesitate to ask me questions if something is not clear for you.Have fun with your robot ! 😄PS: there is a special case for 2 and 3 keys but I'm sure you would have understood, the definitions after '#ifdefNYBBLE' are for Nybble and the definitions after '#else //BITTLE' are for Bittle. Pretty easy. 😉