Skip to main content

Posts

Showing posts from September, 2021

Using LDR With Mblock and Arduino

In this application, we will make an LDR application with the Mblock program. LDR; It is a photoresistor that changes value according to the incident light. You can turn the lamp on and off according to the values ​​in the LDR. In this application, we will first learn to read the values ​​in the LDR, then we will flash the led. Let's come to the circuit elements. 1-Arduino Uno (1 pc) 2-BreadBoard 3-220Ω Resistor(1pcs) 5-LDR(1pcs) 6-Jump Cables We need supplies. Our circuit diagram is as follows. We connect a 220 ohm resistor to one leg of our LDR. We connect a cable to one leg of the resistor we connected and connect this cable to the 5 volt pin (blue cable) and we connect it to the other free leg of the LDR with a GND (- terminal) cable. Thus, we have prepared our circuit. It's time to write our code. In the Mblock program, we add the Arduino program starter code from the Robots menu. After adding the repeat code from the control menu, we add our code to write ...

Space Wars Game With Scratch Program

  Together with the Scratch program, we will make an example of Space Wars game. Shooting and hitting the rocks coming with the spaceship in the space wars game we will do with Scratch. Every time the rocks hit, a life is lost. For this, we first add a space picture to the background in Scratch. We draw 1 Spaceship, 3 Rocks, 1 Bullet from Sprite and add work. From the data, we create a data that we will use in all Sprites with the Number of Rocks Hit and the Health Remaining before the game starts. We select the Spaceship we added and write the above codes in it. First of all, we check which key the user presses or not, which key the user will press and play in the "If" code. If the up arrow key is pressed, we increase the y positive direction by 5 and make the ship move upwards. If the down arrow key is pressed, y takes 5 steps in the negative direction. So there is a downward movement. If the left arrow key is pressed, it moves to the left in the x negative direction. If th...

Blinking LED with Mblock and Arduino

  We will blink the led with the mblock program. The list of materials that will be used in our led circuit before moving on to the codes of the application we will make with the Mblock program: 1-Arduino Uno 2-BreadBoard 3-LED 4-220Ω Resistor 5-Jumper Cables We need supplies. We add a 220 ohm resistor to the long leg of the Led that we added to our breadboard. We connect one leg of the resistor with a jumper cable to the digital pin 8 of our ardunio uno material (You can connect your jumper cable to any digital pin you want between 2-13). The circuit diagram is below. Now let's come to our codes in mBlock; In the Mblock program, we add the Arduino program starter code from the Robots menu. After adding the forever from the control menu, we add the code to whichever digital pin we connected our led to the inside of the "Robots menu ... we add the code to make the pin low. We write 8 because I connect it to digital pin 8. We do not light our led with the code of s...

How to Make Countdown a Maze Game on Scratch

  We will make a countdown maze game example with Scratch. For the countdown maze game example we will make with Scratch, we upload the maze picture we downloaded to our computer from the scene section to the scratch program. Then we select the object that we will move in the maze section from the choose a sprite section and add it to our scene. We bring the object to be moved to the red point, which is the starting point. First of all, we create a variable named Duration to calculate the elapsed time in the maze from the "Variables" menu When you click the green flag, set the duration variable to 40. Our goal is to get the ball to the finish line in 40 seconds. If our ball object to move, we give the x and y coordinates to go to the red starting point. Our object will not move only once. First of all, we add the "Forever" code from the "Control" menu so that it moves every time we press the arrow key. Now it's time to check which direction key is pres...

How to Make a Maze Game on Scratch

  We will make an example of a maze game with Scratch. For the maze game example we will make with Scratch, we upload the maze picture we downloaded to our computer from the scene section to the scratch program. Then we select the object that we will move in the labyrinth section from the puppets section and add it to our scene. We bring the object to be moved to the red point, which is the starting point. First of all, we create a variable named  Duration to calculate the elapsed time in the maze from the "Variables" menu. When you click the green flag, set the duration variable to 0. We give the x and y coordinates for our ball object to move to the red starting point. Our object will not move only once. First of all, we add the "Forever" code from the "Control" menu so that it moves every time we press the arrow key. Now it's time to check which direction key is pressed. For this, we add the "If" code from the "Control" menu. If ...

Day and Night Application With Mblock and Arduino

  Together with the Mblock program, we will make Night and Day Applications. When we run the Night and Day Application, which we made together with the Mblock program, when we press the letter "A" on the keyboard, a brighter scene decor will appear on the screen and the word "Gündüz" will appear and our LED will not light. When we press the letter "S", a darker stage decoration will appear next night and our LED will light up in the circuit we have created. We will make this application in the Mblock program. Before moving on to the codes, the list of materials to be stretched in our led circuit: 1-Arduino Uno 2-BreadBoard 3-LED 4-220Ω Resistor 5-Jumper Cables We need supplies. We add a 220 ohm resistor to the long leg of the Led that we added to our breadboard. We connect one leg of the resistor with a jumper cable to the digital pin 8 of our ardunio uno material (You can connect your jumper cable to any digital pin you want between 2-13). T...

Make To Eat Fishing Game With Scratch

  We will make an example of a fish-eating game with Scratch. For the example of the game we will make with Scratch, we add 3 fish and 1 shark to our scene. We select the shark and add the code pieces in the picture to the code section. Since our shark will always be in motion, we get the "Forever" code block from the Control menu. In the inner part, we add the code piece "point towards mouse-pointer(Turn in the direction of the Mouse Arrow)" from the Motion menu to make the shark move in the direction of the mouse's movement. Thus, wherever we take the mouse, the shark will go in that direction. He will take 3 steps on his way. First, we create a variable called "hunted fish" from the Variables Menu to keep the number of Fish Eaten. We say apply this to all puppets. Let's choose one of the fish and start writing the codes in it. Let the fish eaten as soon as the game start be 0. Let the fish see. Since the fish will be constantly moving, let's...