The Basic Stamp is a mikrocontroller programmable in Basic and is available in various pin numbers and clock speeds. In Germany, it can be obtained at www.elektronikladen.de.
documentation
Basic Stamp editor
As a sensor surface, a wire or conductive metal sheet or foil is used. When touching or approaching the electrode, the Basic Stamp pin is high (255), otherwise low (0). By choosing the capacitor between 2nF und 500nF, the sensor's sensitivity can be varied. data sheet
' {$PBASIC 2.5}
touchsensor PIN 0
INPUT touchsensor
loop:
IF touchsensor = 0 THEN loop
DEBUG "on"
GOTO loop
' {$PBASIC 2.5}
dataIN VAR Byte
main_loop:
'turn CS high then low to kickstart data in
HIGH 7
LOW 7
SHIFTIN 6, 5, LSBFIRST, [dataIN]
DEBUG ? dataIN
PAUSE 1000
GOTO main_loop
This LED includes the three basic colours red (GaAsP), green (GaP) and 2 x blue (Sic) in a single housing. Each colour is controlled separately, with its own pin. The intensity ratios of the colours can be adjusted by changing the relevant currents (Basic Stamp command PWM Pin 0-255 1). This makes it possible to obtain an infinite number of colours and a high intensity. Between the Basic Stamp pin and the anode, a series resistor has to be placed which is calculated by the formula R = (5V - ULED)/ILED.
LED series resistor calculator
data sheet
' {$PBASIC 2.5}
'forward
x VAR Word
FOR x= 0 TO 10000
PULSOUT 0, 500
NEXT
' {$PBASIC 2.5}
'backward
x VAR Word
FOR x= 0 TO 10000
PULSOUT 0, 1000
NEXT
Below the shining cupola, a laptop running the neural network is placed. It also determines the robot's position and emits sound. Laptop and the Basic Stamps controlling the gamefield communicate by means of a radio link. Sender and reciever are available at
www.rentron.com.
manual
' {$PBASIC 2.5}
main:
SEROUT 15, 2400, ["a"]
GOTO main
' {$PBASIC 2.5}
digit VAR Byte
main:
SERIN 0, 2400, 1000, no_signal, [digit] ' receive one byte
DEBUG DEC digit, CR ' display on screen
PAUSE 1000
GOTO main
no_signal:
DEBUG "no signal"
GOTO main
The gamefield is controlled by two Basic Stamp P40. These have 30 freely usable pins, so a total of 20 fields (each red-green-blue) can be illuminated. The Basic Stamp P40 is fast enough to drive the LEDs without flickering. To carry the load, 4 ULN 2803 devices per Basic Stamp are used. As the LEDs have to be connected with the cathode, however, no RGB LEDs can be used here. This has to be compensated by means of a diffusor foil to achieve a uniform light effect.