Vous êtes sur la page 1sur 36

www.parallax.

com 599 Menlo Drive Suite 100 Rocklin, CA 95765


Slide 1

Copyrights and Trademarks


This documentation is copyright 2004 by Parallax, Inc. By downloading or obtaining a printed copy of this documentation or software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication of this documentation for commercial uses is expressly prohibited by Parallax, Inc. Duplication for educational use is permitted subject to the following conditions: Parallax grants the user a conditional right to download, duplicate, and distribute this text without Parallax's permission. This right is based on the following conditions: the document, or any portion thereof, may not be duplicated for commercial use; it may be duplicated only for educational purposes when used solely in conjunction with Parallax products, and the user may recover from the student only the cost of duplication. BASIC Stamp, Stamps in Class, and Board of Education are registered trademarks of Parallax, Inc. If you decide to use the names BASIC Stamp, Stamps in Class, and/or Board of Education on your web page or in printed material, you must state that "BASIC Stamp is a registered trademark of Parallax, Inc.," "Stamps in Class is a registered trademark of Parallax, Inc.," and/or "Board of Education is a registered trademark of Parallax, Inc.," respectively, upon the first appearance of the trademark name. Other brand and product names are trademarks or registered trademarks of their respective holders.

Slide 2

Stamps In Class Curriculum

Cited in Further Investigation Sections

Slide 3

Stamps In Class Curriculum

Cited in Further Investigation Sections

Slide 4

Chapter #1: Getting Started

Parallax CD:
BASIC Stamp Editor
Software BASIC Stamps Windows

Parallax Website:www.parallax.com
BASIC Stamp Editor
Downloads BASIC Stamp Software

Whats a Microcontroller
Documentation Educational Curriculum

Whats a Microcontroller
Downloads Educational Curriculum

BASIC Stamp Manual


Documentation BASIC Stamp Documentation Slide 5

BASIC Stamp Manual


Documentation BASIC Stamp

Excerpts from pages 9 and 7

Introduction
How many microcontrollers did you use today? Whats a BASIC Stamp?

For the Classroom

BASIC Stamp and Board of Education

BASIC Stamp HomeWork Board


Slide 6

Excerpts from pages 1, 2, and 13, 14

Introduction
Amazing inventions with the BASIC Stamp

Excerpts from pages 3 - 4

Slide 7

Chapter #1: Getting Started


Com

10101001

Powercell

10

Alkaline Battery

or

4
6-9VDC

15 14 Vdd 13 12
Red Black

9 Vdc Battery
X4
Pwr

X5

Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0

Vin

Vss

STA in MPS CLA SS


TM

1
Sout Sin ATN Vss P0 P1 P2 P3 P4 P5 P6 P7 Vin Vss Rst Vdd P15 P14 P13 P12 P11 P10 P9 P8

Vss P0 P2 P4 P6 P8 P10 P12 P14 Vdd

Vss P1 P3 P5 P7 P9 P11 P13 P15 Vin

X1

U1

Reset

X2 0 1 2

Board of Education
2000-2003

www.stampsinclass.com

Excerpts from pages 16-20

10

Connect serial cable to computer COM port.

Powercell

Alkaline Battery

0
101

11

1 100

000

01 010

10

00

Write a PBASIC program then download it to the BASIC Stamp

11

100

1 0 00 01 0 0

01

10

00

10

Plug BASIC Stamp into Board of Education (if it is not already plugged in), then connect serial cable and battery or power supply.

6-9VDC

9 Vdc Battery

Pwr

in C

STAM PS LASS
TM

1
Sout Sin ATN Vss P0 P1 P2 P3 P4 P5 P6 P7 Vin Vss Rst Vdd P15 P14 P13 P12 P11 P10 P9 P8

Vss P0 P2 P4 P6 P8 P10 P12 P14 Vdd

Vss P1 P3 P5 P7 P9 P11 P13 P15 Vin

X1

U1

Reset

www.stampsinclass.com

Slide 8

Chapter #1: Getting Started


' What's a Microcontroller - FirstProgram.bs2 ' BASIC Stamp sends message to Debug Terminal. ' {$STAMP BS2} ' {$PBASIC 2.5} DEBUG "Hello, it's me, your BASIC Stamp!" END
Enter this program Click the BASIC Stamp 2 Button Click the PBASIC 2.5 button Click the Run button

Run the BASIC Stamp Editor Software

Excerpts from pages 18-22

Slide 9

Chapter #1: Getting Started


The command:

DEBUG "Hello, it's me"


Causes the BASIC Stamp to send a message to the Computer

Click the Run button

The Debug Terminal appears with a message sent by the BASIC Stamp
10101001

Powercell

10

Alkaline Battery

0
101

11

0 001

000

01

10 001

00

11

100

1 0 00 01 0 0

01

10

00

10

6-9VDC

15 14 Vdd 13 12
Red Black

9 Vdc Battery
X4
Pwr

X5

Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0

Vin

Vss

STAM in C PS LASS
TM

1
Sout Sin ATN Vss P0 P1 P2 P3 P4 P5 P6 P7 Vin Vss Rst Vdd P15 P14 P13 P12 P11 P10 P9 P8

Vss P0 P2 P4 P6 P8 P10 P12 P14 Vdd

Vss P1 P3 P5 P7 P9 P11 P13 P15 Vin

X1

10

U1

Reset

X2 0 1 2

Board of Education
2000-2003

www.stampsinclass.com

Excerpts from pages 20, 23

Slide 10

Chapter #1: Getting Started


comment comment Stamp 2 directive PBASIC 2.5 directive DEBUG command END command

' What's a Microcontroller - FirstProgram.bs2 ' BASIC Stamp sends message to Debug Terminal. ' {$STAMP BS2} ' {$PBASIC 2.5} DEBUG "Hello, it's me, your BASIC Stamp!" END

Excerpts from pages 20-21, 27-28

Slide 11

Chapter #2: Lights on Lights off


BASIC Stamp LED Circuit
P14 470 LED
Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

Vin

Vss

LedOnOff.bs2
' {$STAMP BS2} ' {$PBASIC 2.5}

P14 470
Vss

LED

Vss

DO
HIGH 14 PAUSE 250 LOW 14 PAUSE 250 LOOP

Next Step

Write a PBASIC Program to make the BASIC Stamp Switch the LED circuit input between Vdd (5 V) and Vss (0 V).
SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7
1 24

VIN VSS RES VDD (+5V) P15 P14 P13 P12 P11 P10 P9 P8

SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7

24

VIN VSS RES VDD (+5V) P15 P14 P13 P12 P11 P10 P9 P8

2
3 4 5 6 7

BS2
Vdd Vss

23
22 21 20 19 18

2
3 4 5 6 7

BS2
Vdd Vss

23
22 21 20 19 18

8
9

17
16

8
9

17
16

10
11

15
14

10
11

15
14

12

13

12

13

BS2-IC

BS2-IC

Excerpts from pages 47-50

Slide 13

Chapter #2: Lights on Lights off


Changing the program to make the LED flash on/off 10 times
Before making any changes, save the original program, then save a copy (to be modified) under a new name:

LedOnOffTenTimes.bs2
' {$STAMP BS2} ' {$PBASIC 2.5} counter VAR Byte FOR counter = 1 TO 10 DEBUG ? counter HIGH 14 PAUSE 500 LOW 14 PAUSE 500 NEXT DEBUG "All done!"

Use the same circuit Replace DO and LOOP with the segments of code shown here. Run your modified program. Remember to save your modified program.
Excerpts from page 54

END
Slide 14

Chapter #2: Lights on Lights off


LED Test Circuit Parts
(1) LED Green (1) LED - Yellow (2) Resistor 470 (yellow-violet-brown)

Next Step - Make both LEDs flash on/off

BASIC Stamp LED Circuit (Modified)


Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

Open FlashLed.bs2 Add two lines of code Run your modified program. Remember to save your modified program under a different name! Use FlashBothLeds.bs2

FlashBothLeds.bs2
Vin Vss

' {$STAMP BS2} ' {$PBASIC 2.5} DO HIGH 14 HIGH 15 PAUSE 250 LOW 14 LOW 15 PAUSE 250 LOOP
Slide 15

P15 P15 P14 P14

470 470 470 470 LED LED Vss Vss Vss Vss LED LED

Important: Leave this circuit on your board!


This circuit is re-used in the next set of activities. Do not take it apart before building the next circuit.
Excerpts from pages 58-59

Chapter #3: Digital Input - Pushbuttons


LED Test Circuit Parts How the Pushbutton Works

(1) Resistor 220 (red-red-brown) (1) Resistor 10 k (brown-black-orange) (1) Pushbutton - normally open
1, 4 2, 3 1 2 4 3

1, 4 2, 3

1, 4 2, 3

Pushbutton Circuit
Vdd Vin Vss

(2) Jumper wires


Vdd
Vdd
X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

P3
P3 220 220 10 k 10 k

Vss Vss

Excerpts from pages 72, 76

Slide 16

Chapter #3: Digital Input - Pushbuttons


ReadPushbuttonState.bs2
' {$STAMP BS2} ' {$PBASIC 2.5}
DO

Follow instructions with checkmarks on page 78 How the Circuit and Program Work
Vdd
SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7
1 24

VIN VSS RES VDD (+5V) P15 P14 P13 P12 P11 P10 P9 P8

Vdd

2
3 4 5 6 7

DEBUG ? IN3 PAUSE 250


10 k 220

BS2

23
22 21 20 19

1 0

18

8
9

17
16

10
11

15
14

10 k

220

LOOP
Vss

12

13

BS2-IC

Vss

Vdd

SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7

24

VIN VSS RES VDD (+5V) P15 P14 P13 P12 P11 P10 P9 P8

Vdd

SOUT SIN ATN VSS P0 P1 P2 P3 P4 P6

24

VIN VSS RES VDD (+5V) P15 P14 P13 P12 P11 P10 P9 P8

2
3 4 5 6 7

BS2

23
22 21 20 19

2
3 4 5 6 7

BS2

23
22 21 20 19

1 0

18

1 0

18

8
9

17
16

8
9

17
16

10 k

220

10
11

15
14

10 k

220

P5 10
11

15
14

12

13

P7 12

13

BS2-IC

BS2-IC

Vss

Vss

Excerpt from page 77 - 78

Slide 17

Chapter #3: Digital Input - Pushbuttons


Pushbutton/LED Circuit Parts
(1) Pushbutton normally open (1) Resistor - 10 k (brown-black-orange) (1) LED any color (1) Resistor 220 (red-red-brown) (1) Resistor 470 (yellow-violet-brown) (2) Jumper wires

Follow instructions with checkmarks on page 81 PushbuttonControlledLed.bs2


' {$STAMP BS2} ' {$PBASIC 2.5} DO DEBUG ? IN3 IF (IN3 = 1) THEN HIGH 14 PAUSE 50 LOW 14 PAUSE 50

Pushbutton/LED Circuit
P14 P14 470 470 Vss Vss Vdd Vdd LED LED
Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

Vin

Vss

ELSE PAUSE 100


ENDIF LOOP

P3 P3 220 220 10 k 10 k

Vss Vss

Excerpts from pages 80-83

Slide 18

Chapter #3: Digital Input - Pushbuttons


PushbuttonControlOfTwoLeds.bs2
Follow instructions on pages 83-87 Pushbutton/LED Circuit Parts
' {$STAMP BS2} ' {$PBASIC 2.5} DO DEBUG HOME DEBUG ? IN4 DEBUG ? IN3 IF (IN3 = 1) THEN HIGH 14 PAUSE 50 ELSEIF (IN4 = 1) THEN HIGH 15 PAUSE 50
LED Vss
Vdd P4 220 P3 220 10 k 10 k Vdd

(2) Pushbuttons normally open (2) Resistors - 10 k (brown-black-orange) (2) Resistors 470 (yellow-violet-brown) (2) Resistors 220 (red-red-brown) (2) LEDs any color
P15 470 P14
Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

Vin

Vss

++

470 LED Vss

ELSE PAUSE 50 ENDIF LOW 14 LOW 15

PAUSE 50
Vss Vss

Excerpts from pages 83-87

LOOP

Slide 19

Chapter #4: Controlling Motion


Important: Leave the P14 LED and pushbutton circuits on your board!
These circuits are re-used in this set of activities.

Servo Circuit
P14 470 LED

Servo Circuit Parts

(1) Resistor 470 (yellow-violet-brown) (1) LED any color (1) Servo (STD)
15 14 Vdd 13 12

Vin

Vss

P14

White Red Black

Servo

White Red Black


X4 X5

Red Black

Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

Vin

Vss

Vss

standard servo www.parallax.com

Excerpts from page 107

Slide 20

Chapter #4: Controlling Motion


10 oclock 2 oclock 12 oclock

PULSOUT pin, duration

standard servo www.parallax.com

standard servo www.parallax.com

standard servo www.parallax.com

Use 0 to 15 to select BASIC Stamp I/O pin P0 through P15

duration 2 s = pulse duration

1.0 ms

2.0 ms

1.5 ms

Example:

PULSOUT 14, 1000


pulse duration 2 s 1000 2000s 2.0 ms
Vin
2.0 ms Vdd (5 V) Vss P14 470 LED

P14

White Red

Servo

Vss (0 V)

Black

Excerpts from pages 113-114

Vss

Slide 21

Chapter #4: Controlling Motion


Excerpts from Example Program: ServoTest.bs2
FOR counter = 1 TO 150 PULSOUT 14, 1000 PAUSE 20 NEXT

2.0 ms Vdd (5 V)

2.0 ms
standard servo www.parallax.com

3 seconds
Vss (0 V)

20 ms

FOR COUNTER = 1 TO 150 PULSOUT 14, 500 PAUSE 20 NEXT

1.0 ms Vdd (5 V)
standard servo www.parallax.com

1.0 ms

3 seconds Vss (0 V)
20 ms

FOR counter = 1 TO 150 PULSOUT 14, 750 PAUSE 20 NEXT

1.5 ms Vdd (5 V)
standard servo www.parallax.com

1.5 ms

Vss (0 V)

3 seconds

20 ms

Excerpts from pages 115-118

Slide 22

Chapter #4: Controlling Motion


Follow instructions from Activity #2, pg. 119-124

Excerpt from Example Program: ServoControlWithDebug.bs2


DEBUG CLS, "Enter number of pulses:", CR DEBUGIN DEC pulses
DEBUG "Enter PULSOUT duration:", CR DEBUGIN DEC duration

Transmit windowpane

Receive windowpane
Excerpts from pages 119 - 124 Slide 23

Chapter #4: Controlling Motion


Follow instructions from Activity #3 pg. 125 128 Excerpts from Example Program: ServoVelocities.bs2
counter VAR Word
Counter increments with FORNEXT loop. STEP value controls the rate at which counter increases

FOR counter = 500 TO 1000 STEP 4 PULSOUT 14, counter PAUSE 20 DEBUG DEC5 counter, CR, CRSRUP NEXT

As counter changes, so does the pulse width. As the pulse width changes, the servos position updates. Position changing over time gives an apparent velocity.

FOR counter = 1000 TO 500 STEP 10 PULSOUT 14, counter PAUSE 20 DEBUG DEC5 counter, CR, CRSRUP NEXT

Count down instead of up at a faster step rate. Excerpts from pages 125-128 Slide 24

Chapter #4: Controlling Motion


Extra Pushbutton Parts
(2) Pushbuttons normally open (2) Resistors 10 k (brown-black-orange) (2) Resistors 220 (red-red-brown) (3) Jumper wires
The pushbutton circuit should still be on your board. If not, build it now.
P14 470 LED

Vin

Vss

P14
15 14 Vdd 13 12

White Red Black

Servo

White Red Black


X4 X5

Red Black

Vdd X3
P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

Vin

Vss

Vss

Vdd

Vdd

P4 220 P3 220
standard servo www.parallax.com

10 k

10 k

Vss

Vss

Excerpts from pages 129 - 130 Slide 25

Chapter #4: Controlling Motion


Excerpt from: ServoControlWithPushbuttons.bs2
DO IF IN3 = 1 THEN IF duration > 500 THEN duration = duration - 25 ENDIF ENDIF IF IN4 = 1 THEN IF duration < 1000 THEN duration = duration + 25 ENDIF ENDIF PULSOUT 14, duration PAUSE 10 DEBUG HOME, DEC4 duration, " = duration" LOOP
Excerpts from pages131-133 Slide 26

Follow instructions with checkmarks on page 132.

Chapter #5: Measuring Rotation


Important more info:
Replace your pushbutton circuits with this dial circuit. Remember to leave the P14 LED and servo circuits connected. NOTE: The pot must be firmly seated in its breadboard sockets.
Run ReadPotWithRcTime.bs2 Activity #3 p. 149 Run ControlServoWithPot.bs2 Activity #4 p. 152 Have fun controlling the servo with the pot.

Dial Circuit Parts


(1)

Resistor 220 (red-red-brown) (1) Capacitor 0.1 F


104

Dial Circuit
Vin X3 Vss

0.1 F 0.1 F

P7 220

nc

(2) Jumper wires 103 0.01 F (1) Potentiometer 10 k


A A

Pot 10 k

0.1 F

+ +
+
W B A
10 k k 10 Pot Pot W W

Vss

P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

B B

Excerpts from pages 149-156

Slide 27

Chapter #5: Measuring Rotation


Run ReadPotWithRcTime.bs2 Twist the potentiometers input shaft, and make notes of the time values displayed by the Debug Terminal. Your course guide will explain how to adjust the example program so that it works best with the pulsout command and gives your servo a range of motion that uses the potentiometers entire range of motion.

Excerpt from: ReadPotWithRcTime.bs2

ControlServoWithPot.bs2
' {$STAMP BS2} ' {$PBASIC 2.5} time DO HIGH 7 PAUSE 10 RCTIME 7, 1, time VAR Word

HIGH 7
PAUSE 100 RCTIME 7, 1, time

time = time + 330 PULSOUT 14, time

LOOP
Excerpt from page 151-156 Slide 28

Chapter #5: Measuring Rotation


Run ReadPotWithRcTime.bs2 Twist the potentiometers input shaft, and make notes of the time values displayed by the Debug Terminal. Your course guide will explain how to adjust the example program so that it works best with the pulsout command and gives your servo a range of motion that uses the potentiometers entire range of motion.

Excerpt from: ReadPotWithRcTime.bs2

ControlServoWithPot.bs2
' {$STAMP BS2} ' {$PBASIC 2.5} time DO HIGH 7 PAUSE 10 RCTIME 7, 1, time VAR Word

HIGH 7
PAUSE 100 RCTIME 7, 1, time

time = time + 330 PULSOUT 14, time

LOOP
Excerpt from page 147 - 148 Slide 29

Chapter #6: Digital Display


Common Cathode

Display Parts
(8) Resistors 1 k (brown-black-red) (5) Jumper wires (1) 7-segment LED

10 9 8 7 6
G F A B

1 E

4 C

6 B

7 A

9 F

10 G

5 DP

A F G E D C B

LEDs

3
E D C DP

1 2 3 4 5
Common Cathode

DP EDC GFAB

1 k P15 P14

P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

P13 P12 P11 P10 P9 P8 E LEDs C DP G F A B

X3 Vdd Vin Vss

common Vss

Excerpts from pages 166-7, 172-173

Slide 30

Chapter #6: Digital Display


Predict which segment will glow. How long will each segment glow? In what order will they glow?

SegmentTestWithHighLow.bs2
'{$STAMP BS2} '{$PBASIC 2.5} pinCounter VAR Nib

DP EDC GFAB

DEBUG "I/O Pin", CR, "-------", CR FOR pinCounter = 8 TO 15 DEBUG DEC2 pinCounter, CR HIGH pinCounter PAUSE 1000 LOW pinCounter NEXT
Excerpts from pages 173-174

Common Cathode

10 9 8 7 6
G F A B

P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

X3 Vdd

A F G E D
E D C DP

B
Vin

C
Vss

1 2 3 4 5

Run the example program shown on this slide and compare to your predictions. Slide 31

Common Cathode

Chapter #6: Digital Display


Run the example program from this slide. Make notes on how the OUTH and DIRH variables control the I/O pins, which in turn control the segments.

Excerpt from: DisplayDigits.bs2


'{$STAMP BS2} '{$PBASIC 2.5} OUTH = %00000000 DIRH = %11111111 ' BAFG.CDE OUTH = %11100111 PAUSE 1000 OUTH = %10000100 PAUSE 1000 OUTH = %11010011 PAUSE 1000 OUTH = %11010110 PAUSE 1000 OUTH = %10110100 PAUSE 1000

Vdd X3 X3

Vin

Vss

OUTH = %00000000 DIRH = %11111111


Common Cathode

' 4
Excerpts from pages 174-178

BAFG.CDE OUTH = %11010110

P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

10 9 8 7 6

G F

Common Cathode

A B

' 3

Vdd

' 2

Vin

Vss

' 1
C

1 2 3 4 5

' Digit: ' 0

P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

E D

C DP

Slide 32

Chapter #6: Digital Display


FOR index = 0 TO 9 LOOKUP index, [ %11100111, %10000100, %11010011, %11010110, %10110100, %01110110, %01110111, %11000100, %11110111, %11110110 ], OUTH DEBUG " PAUSE 1000 NEXT ", DEC2 index, " ", BIN8 OUTH, CR

Excerpt from: DisplayDigitsWithLookup.bs2


Lookup tables are useful for many things. Make notes on how the LOOKUP command is used to place a predetermined sequence of bit patterns into the OUTH variable.

Excerpts from pages 180-181

Slide 33

Chapter #8: Frequency and Sound


Build the piezospeaker circuit. Run TestPiezoWithFreqout.bs2

TestPiezoWithFreqout.bs2
'{$STAMP BS2} '{$PBASIC 2.5}

Piezospeaker Circuit Parts


(2) Jumper wires (1) Piezoelectric speaker

DEBUG "Tone sending...", CR


FREQOUT 9, 1500, 2000 DEBUG "Tone done."
I/O pin = P9 duration = 1500 ms = 1.5 s
Vin Vss

f = 2000 Hz T = 12000 s

Piezospeaker Circuit
Vdd X3

P9

P9

Vss

Vss

P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 X2

T
+
P9

Vss

Excerpt from page 219-221

Slide 34

Chapter #8: Frequency and Sound


Excerpts from: ActionTones.bs2
duration frequency VAR VAR Word Word
Run ActionTones.bs2

DEBUG "Alarm...", CR PAUSE 100 FREQOUT 9, 500, 1500 PAUSE 500 FREQOUT 9, 500, 1500 PAUSE 500

DEBUG "Robot reply...", CR PAUSE 100 FREQOUT 9, 100, 2800 FREQOUT 9, 200, 2400 FREQOUT 9, 140, 4200 FREQOUT 9, 30, 2000 PAUSE 500

DEBUG "Hyperspace...", CR PAUSE 100 FOR duration = 15 TO 1 STEP 1 FOR frequency = 2000 TO 2500 STEP 20 FREQOUT 9, duration, frequency NEXT NEXT
Excerpts from pages 222-223 Slide 35

Chapter #8: Frequency and Sound


MixingTones.bs2
'{$STAMP BS2} '{$PBASIC 2.5}
DEBUG "Frequency = 2000", CR FREQOUT 9, 4000, 2000 DEBUG "Frequency = 3000", CR FREQOUT 9, 4000, 3000 DEBUG "Frequency = 2000 + 3000", CR FREQOUT 9, 4000, 2000, 3000

DEBUG "Frequency = 2000 + 2001", CR FREQOUT 9, 4000, 2000, 2001

DEBUG "Frequency = 2000 + 2002", CR FREQOUT 9, 4000, 2000, 2002


DEBUG "Frequency = 2000 + 2003", CR FREQOUT 9, 4000, 2000, 2003 DEBUG "Frequency = 2000 + 2005", CR FREQOUT 9, 4000, 2000, 2005 Run MixingTones.bs2 DEBUG "Frequency = 2000 + 2010", CR FREQOUT 9, 4000, 2000, 2010 DEBUG "Done", CR END Excerpt from page 225 - 226 Slide 36

Chapter #8: Frequency and Sound


Excerpt from DoReMiFaSolLaTiDo.bs2

DEBUG "Mi...", CR: DEBUG "Fa...", CR: DEBUG "Sol..", CR:

FREQOUT 9,500,1319 FREQOUT 9,500,1396 FREQOUT 9,500,1568

' E6 ' F6 ' G6

1244.5

1480.0

1661.2

1864.7

1217.5

2489.0

2960.0

3322.4 3136.0 3520.0

Run DoReMiFaSolLaTiDo.bs2
1046.5

1318.5

1396.9

1568.0

1760.0

1975.5

2093.0

2349.3

2637.0

2793.0

3729.3 3951.1
A 7 #
or

1108.7

Frequencies in Music

C 6 #
or

D 6 #
or

F 6 #
or

G 6 #
or

A 6 #
or

C 7 #
or

D 7 #
or

F 7 #
or

G 7 #
or

D 6 b

E 6 b

G 6 b

A 6 b

B 6 b

D 7 b

E 7 b

G 7 b

A 7 b

B 7 b

C6 D6 E6 F6 G6 A6 B6 C7 D7 E7 F7 G7 A7 B7 C8

Excerpts from pages 227 - 229

4186.0

1174.7

Slide 37

Vous aimerez peut-être aussi