This notebook demonstrates how to use Mathematica to send integers to real world devices via the bTop-2's digital IO ports.  For the purpose of the demo we send out iterations of the Rule 30 cellular automaton.  A wiring diagram is available from Perfectly Scientific, showing how to connect LED's to the bTop-2 such that upon running this notebook, the Rule 30 automaton appears on the LED's.

We begin, as always, by loading the BTopTools package.

<<BTopTools`

If we connect (say) 5 LED's to the bTop-2, we can display on them every integer from 0 to 31.  To make sure everything is connected correctly we start out with a simple loop to test every value.

While[True, For[j = 0, j≤31, j ++, BTopDigital[BTopDevice[1], {BTopDigitalIOPort["B"]}] = {j} ; Pause[1] ; ]] ;

Once everything is connected and every integer between 0 and 31 can be displayed, we can make a light show out of the Rule 30 automaton.  The following code repeatedly applies Rule 30, starting with a single cell "on" in a sea of off cells.

state = {1} ; num = FromDigits[state, 2] ; While[True, (* Send the current state out t ... {j, Floor[Length[state]/2] - 2, Floor[Length[state]/2] + 2}], 2] ; Pause[1] ; ] ;


Created by Mathematica  (January 24, 2007)