LEDs are like tiny lightbulbs. However, LEDs require a lot less power to light up by comparison.
In this project, we will turn ON LED when the space key is pressed and turn it OFF when released. There is a programmable LED in evive which is connected to the digital pin 13. We will use the same LED for the project.
Given below are some facts about the LEDs you should know before using one:
There is no circuit required in this project 😎
You just have to use your evive inbuilt LED.
The LED is connected to digital pin 13 internally. So, when the state of digital pin is:
We know, we can control the digital pin 13 using programming, hence we can control LED.
Scratch is a graphical programming language which let you interface and control your evive with laptop. If you have not installed Scratch visit here to get full instruction on installing Scratch.
To learn about the Scratch interface, visit here. There are four important things you have to know in Scratch:
We have developed these Scratch extensions containing special blocks through which you can control your evive in Scratch:
In Scratch, there are two modes in which you can work:
In this project we are using keyboard to control, hence we have to work in Scratch mode to use the block which senses the keyboard input.
We will be continuously checking if the Space key is pressed. This will be either true or false. Now, we will use conditional statements, which will take decision to execute particular statements according to the result. In our case, this is if-else, where if the result is true (i.e. Space key is pressed), LED will be ON, else LED will be OFF.
The next step is to express your logic in a way so that the computer can understand it. This is easy if one uses Scratch since it has built in blocks for basic functions and one does not have to write stuff every time.
Your program is ready now and you can press ‘space’ to start it. The whole script will start glowing indicating that the program is running. To stop it press ‘Esc’ on keyboard.
only evive is required in this project. We are using Pin 13 LED.