Fruit-Collecting Game with Pinoo

Project Purpose: To create a fruit picking game with the joystick module using the Pinoo Control Card.

Duration: 2 lessons

Age Group: 9 years old and above

Pinoo Sets: Maker set and full set.


  • Learns to code Pinoo control card
  • Learns to code the joystick module.
  • Improves the skill of setting up algorithms.
  • Improves coding skill.


Materials to be Used: Mblock 3 program, Pinoo control card, Joystick Module, Connection cables



Materials Required for Design: Cardboard, Color Cardboard, silicone gun, scissors


Project Preparation:
Draw a medium sized apple on the cardboard and cut it. This will be our gamepad. You can also use another fruit drawing if you wish.


We draw a joystick-sized square at the bottom of the circle and cut it. Then we cover the round by adding the handle.
We fix the joystick with the silicone gun so that the inscriptions on it are on the left side (in horizontal position).

We fix the Pinoo board to the back of the apple and make the connections.

We pay attention to the colors on the module for our joystick connection. We make our connection to the red-yellow input (number 9), which has the same colors on the Pinoo card.

We will use mblock-3 application for the coding part.
Let's connect our Pinoo Control Card to the computer with the help of the connection cable and enter the Mblock3 application. Then, let's introduce our Pinoo Control Card to the computer. To do this, we first click on the serial port option from the Connect tab. Then we select COM3. (The number may differ depending on the computer and the port.)
After making the serial port connection, let's select the card we will use from the Cards tab. We are working with Arduino Nano model.
In order to add the Pinoo extension to our computer, we click on the manage extensions option from the Extensions tab. In the window that opens, we type "Pinoo" in the search engine and just click download to the result. It has been installed on our computer.
After selecting our card, we click on the Pinoo option from the Extensions tab. We will write our codes with the Pinoo extension.

In the coding part, we will first design the game. For this, we delete the panda by clicking the right mouse button on the panda puppet. Then, by clicking the new dummy button, we add three fruits and a puppet named button2 (this will be our dummy basket).

If you wish, you can change the background by clicking the select the decor from the library button.

We click on the Apple puppet, the first fruit we added, and when the Green Flag is clicked from the Events menu, we get its code to start the game.
When the game starts, we take the go to mouse arrow command from the movement tab so that the fruits appear in random positions and change the go to mouse arrow statement from the drop-down menu to a random stage point.
We determine the starting coordinate for the fruit to move on a vertical plane (y axis). From the motion tab, we take the command y get 0 and change the 0 expression to 180.
In order for the fruit to move on the y axis (vertically) continuously, we first get the repeat command from the control tab. Then we take the command to increase y to 0 from the movement tab and change the expression 0 to -5.
If the fruit reaches the end of the stage during its vertical movement, we want it to move up and down (from the y position 180) from a random position on the stage. For this, we first take the block if it is from the control tab. We consider the end of the y position (vertical movement) of the stage as -170.
*** We write the same code blocks for all fruits.
We want 10 points to be earned for each fruit to be collected. For this, we create a variable named points from the Data & Block tab. When the game starts (when the green flag is clicked), the score is 0.

If the button 2 (basket) touches the puppet with fruit (fruit has been collected), the score variable is increased by 10 and the fruit moves up and down (from 180 y position) within the stage. We want all these operations to be continuous.

From the control tab, we get the repeat code block and the block if it is. If the block touches the condition field button2 (basket), we get the is it worth command from the detection tab, and select and place button2 from the drop-down menu.

*** We write the same code blocks for all fruits.
Click on the button2 (basket) dummy. At the beginning of the game (when the green flag is clicked) we want the dummy to be at a certain starting point (x: 0 y: -136).

We will provide the movement of our basket, that is button2, with the values ​​that the joystick takes on the x axis. To learn the values, we create a new variable named x from the Data & Block tab.

To indicate that the variable X is constantly equal to the value from the joystick, we take the repeat block from the control tab, the code block from the Data & Block tab to get x 0, and place the code block related to the joystick from the Robots tab instead of 0.


*** Let's click on the green flag and move the joystick to the right and left to observe the changes in the values ​​in the x header on the left of the screen.

In order to determine the threshold values ​​of the joystick movements (x), we need to determine the values ​​that the joystick takes on the far right, stationary and leftmost.

• The values ​​for the far right (the forward movement of the puppet) approach 1023. An average value of 600 was determined.

• Its steady state is approximately 500,

• For the far left (backward movement of the puppet) the values ​​approach 0. An average value was determined as 300.

You can update these values ​​according to your own game.

Now, let's create the necessary condition states for all these threshold values. From the Control tab, if the block is and from the operations tab, we create the condition statement by taking the block is smaller and greater than.

The commands we will use for the forward and backward movement of the puppet. We get the x 10 increase command from the movement tab. For the backward movement of the puppet, we change the value 10 to -10.
*** Let's move the joystick left and right by clicking the green flag. Let's observe the movement of the puppet.
In order to play the game within a certain time, we create a variable named duration from the Data & Block tab.

When the green flag is clicked, that is, when the game starts, we want the time to be 0 and then the time to increase continuously with 1 second intervals.


If the time is equal to 30, we want the game to be written on the screen and the game to stop.

For this, we get the expression if if from the control tab and equals from the operations tab. In case of fulfillment of the condition, we take the hello 2 sec command from the view tab and the stop all block from the control tab. We change the hello to GAME OVER.



After completing our codes, we check the operation of our game by clicking the green flag.

• Our time will start to increase with the start of the game,

• The basket should move to the right when we pull the joystick to the right, and to the left when we pull it to the left

• Our score should increase when fruits touch the basket,

• When the time is equal to 30, the game must be over.