Scratchpad is where the BrainStem stores variable information that can be used for multiple reflexes.  Information stored here can be used for many applications because, when a value is changed, the changes carry throughout the rest of the reflexes.

BrainStem application examples require that the BrainStem Support package. Acroname provides simulated BrainStem modules within this distribution that can be used, in the absence of hardware, using the Symonym application .

The Setup

There are several hardware components needed for this example:

  • 40-Pin EtherStem 1.0 Module
  • 40-Pin Development Board
  • Ethernet Cable
  • Power Supply
  • Computer

- OR -

  • Symonym Software Package
Example Setup

Example Setup


The Scratchpad serves as on-board RAM.  It is communicated to by the host and reflexes.  It is available to multiple processes at once as a shared location and makes inner process communication quick and easy.  The Scratchpad provides a location to store important information that can be accessed and manipulated at any time, with the manipulations affecting all relevant processes.

Developing The Code

The mapEnable function utilizes a function call to primerIterate.  The function primerIterate utilizes the System class and the Timer class.  The Expiration entity of the Timer class is then used to adjust the length of time between Timer executions.  Inside the Timer the System class utilizes the LED entity to get the current state of the User LED and to inverse that state.  The Timer then uses a function call to primerIterate again.

Changing LED Flash Rate

#include <a40PinModule.reflex>

#define DELAY 1000000
#define INCREMENT 10000

a40PinModule stem;

pad[0:3] signed int timing;

void primerIterate() {
  if(timing >= DELAY) {
  } else {

reflex mapEnable() {
  timing = 10000;

reflex timer[1].expiration(){

  unsigned char bLEDState;


  timing = timing + INCREMENT;


Line 8 - Creates a variable in the scratchpad called timing.
Line 12 - Turns User LED off after timing.
Line 14 - Starts Timer [1].
Line 20 - Calls the primerIterate function.
Line 27 - Reads the current User LED state.
Line 28 - Inverses current User LED state.
Line 32 - Calls primerIterate function.