BrainPad Memory
At BrainPad circuits, we have a memory inside it, so this helps us to save the code in it, and we can run this code by connecting it to a power supply.
Recording Mode
![](https://www.brainpad.com/wp-content/uploads/2023/08/WhatsApp-Image-2023-08-16-at-20.01.50.jpg)
By using recording mode, you can save the code to the circuit, so the code will run when you plug in any power supply.
This mode helps you to record the code at BrainPad, so you can run it any time you need, For example, if you want to blink an LED you can add the code:
@Loop
DWrite(108, 1) : Wait(250)
DWrite(108, 0) : Wait(250)
Goto Loop
So, each time you connect the BrainPad to a power supply, it will blink the LED directly
Immediate Mode
![](https://www.brainpad.com/wp-content/uploads/2023/09/Screenshot-2023-09-04-121318.png)
Immediate mode helps you to run the code directly to the BrainPad circuit, but this code won’t be saved inside the BrainPad circuit when you plug it into any power supply.
Can we run many lines of code in immediate mode? or only one command?
Actually, Yes. We can run more than one command by adding a colon “:” between it like this:
![](https://www.brainpad.com/wp-content/uploads/2023/09/Screenshot-2023-09-13-021238.png)
Hybrid Mode
Calculator
Can we use both modes together? YES!, It’s one of the nice things to combine between these two modes, and it’s one of the valuable steps to take.
We can code a function using Recording mode, for SUM two numbers and print the result:
![](https://www.brainpad.com/wp-content/uploads/2023/09/Screenshot-2023-09-04-125800.png)
and then we can call this function in Immediate mode:
![](https://www.brainpad.com/wp-content/uploads/2023/09/Screenshot-2023-09-04-125241.png)
keep in mind that when we plug in the circuit to any power supply, the @Sum function will run, because it is stored in the memory. to avoid this we can add “Exit” at the first of the code in recording mode:
![](https://www.brainpad.com/wp-content/uploads/2023/09/Screenshot-2023-09-26-195030.png)
Easy Testing
What can we also benefit from the hybrid mode to do easy testing for any piece of code while we are programming, if we are building a program to control Servo motors, and we need to test if the LED code is working or not, without changing the main Servo code, then we can do this:
![](https://www.brainpad.com/wp-content/uploads/2023/09/Screenshot-2023-09-12-154735.png)
In this way, we can run the “DWrite()” command without affecting the whole code.
BrainStorm:
The idea of having a memory in the circuit helps us to upload the code and detach the circuit from the computer, and enables us to connect the circuit with a power source to run the code, so this allows us to run the code without the circuit being connected to the computer, i.e. there is no need for a computer always
Can we program a smart door and connect the door to the circuit? So we can make the home completely smart?