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
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
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:
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:
and then we can call this function in Immediate mode:
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:
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:
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?