DUE Input ➤ Process ➤ Output

DUE Input ➤ Process ➤ Output

With computers, everything is either an input that feeds info into the “brain” or an output that is controlled by the “brain”. The keyboard is an input, the monitor is an output. Can we say this is similar to our brains?



Devices Input and Output

Just like computers, smart devices have inputs and outputs. Take a microwave oven for example, it takes user input from the keyboard and has a sensor to detect if the door is open. Those feed info into the processor inside. Depending on what buttons were pressed and the state of the door, the processor then controls the display, spinning the motor and heating device.

In & Out Methods

Functions reflect the Input -> Process -> Output concept. Some functions control things, like moving a robot, using Move(), others are input methods, like Sense().

Let’s assume the user wants to read button A. As you can imagine, a button is an input to the processor. And then we need to want to control the LED. The LED is an output from the processor.

Let us check if a button is pressed to flash the LED 3 times. Button and LED functions will be detailed in future lessons.

BtnEnable('A', 1)
  If x=1
Goto Loop

While you may think computers are smart and they just know when the button is pressed with the statement above, that is not entirely true. That statement checks the button one time and never again. Say we want to show the button state on the display/LEDs. We would have to repeatedly check the button and update the status in a loop. But how many times a second will we check the buttons?

What’s Next?

You can now start wiring the BrainPad to the physical world and experiment with available elements.


The previous example used a loop that constantly checked for the button press and if the LED was pressed, it continued to blink the LED. Modern systems/languages use “Events”. An Even is usually a function that gets called when an event occurs. The internal operating system does its best to track that event. There are many ways to how hardware checks for the “event”. For example, a mobile phone is mostly asleep to conserve power. A tiny, and very low-power, circuit keeps an “eye” on the display in case it is touched. This generates an event to wake up the processor and activates the phone.

Content Licensing

Twitter Feed
Hot off the press!