Transcript Mic1-1
Basic Stamp
OEM module
By Wilmer Arellano
The BASIC Stamp 2
OEM is a discreet
component version of
the BS2 which may be
purchased in kit form.
The male header
provides the means to
‘plug-it’ into your own
board, or connect to
other boards.
P0-P15 I/O
Reset Input (RES)
Power the board with EITHER:
A) 5.5-15VDC on Vin. This will also
provide 5VDC regulated output on
Vdd.
B) Regulated 5V Input on Vdd.
5.5 – 15V input (Vin)
Ground- 0V (Vss)
Regulated 5V (Vdd)
2
Using the breadboard (Socket board)
The bread board has many strips of metal
(copper usually) which run underneath the
board.
To use the bread board, the legs
of components are placed in the
holes (the sockets). The holes
are made so that they will hold
the component in place. The
circuit is built by placing
components and connecting them
together with jumper wires.
The metal strips are laid out as shown in
orange. The long top and bottom row of
holes are usually used for power supply
connections.
OEM BASIC Stamp
2sx
220 Ohm
9V
5V
Ground
Connection
220 Ohm resistor should be
connected to pin P4 of the
OEM Basic Stamp 2sx.
“+” (long) lead of LED
should be connected to
opposite side of the
resistor. The other (short)
lead of the LED goes to “-”
220 Ohm
9V
battery
LED
Flashing LED
' {$STAMP BS2sx}
' {$PBASIC 2.5}
Green:
'Label Or point were you can RETURN
LOW 4
'Set pin 4 an output pin and low voltage "0"
PAUSE 1000
'Pause 1000 ms
HIGH 4
'Set pin 4 an output pin and high voltage "1"
PAUSE 1000
'Pause 1000 ms
GOTO Green
Code to test your microcontroller
' {$STAMP BS2sx}
' {$PBASIC 2.5}
start:
HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 100
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11
LOW 12
LOW 13
LOW 14
LOW 15
PAUSE 100
GOTO start
Microcontroller chip
220 Ohm
220 Ohm
9 V battery
OEM BASIC Stamp 2sx
220 Ohm
COM port
Wiring diagram
220 Ohm
LED
15 KOhm
LED
Note:
- is connection to
negative pole of the
battery
LED
PIR
Motion
sensor
OUT
Push
button
Buzzer
Flashing LED + Switch Input
' {$STAMP BS2sx}
' {$PBASIC 2.5}
Green:
'Label Or point were you can RETURN
LOW 4
'Set pin 4 an output pin and low voltage "0"
PAUSE 1000
'Pause 1000 ms
HIGH 4
'Set pin 4 an output pin and high voltage "1"
PAUSE 1000
'Pause 1000 ms
DEBUG ? IN0 'Input the value of pin 1
PAUSE 1000
'Pause 1000 ms
GOTO Green
Making Sound
' {$STAMP BS2sx}
' {$PBASIC 2.5}
start:
FREQOUT 1, 10000, 1000
PAUSE 1000
GOTO start
Making Sound
' {$STAMP BS2}
' {$PBASIC 2.5}
start:
HIGH 1
PAUSE 5
LOW 1
PAUSE 5
GOTO start
CAR 1
' {$STAMP BS2sx}
' {$PBASIC 2.5}
PAUSE 5000
HIGH 10
LOW 11
start:
HIGH 4
HIGH 8
LOW 9
PAUSE 3000
LOW 4
LOW 8
PAUSE 3000
HIGH 9
PAUSE 3000
LOW 9
PAUSE 3000
GOTO start