Vtech PreComputer Power Pad Plus User Manual - Page 54

Sound, Function

Page 54 highlights

SOUND This is a command to generate a sound note. SOUND consists of two functions: frequency and duration frequency The frequency of the sound in hertz; a value in the range 0 < frequency parameter < 256 duration The number of the system clock ticks so the sound lasts; a value in the range 0 < duration parameter < 256 FOR ... TO ... STEP ... NEXT Line# FOR variable = initial value TO final value STEP stepsize (optional) Line# Line# Line# Line# NEXT variable The FOR ... NEXT statement repeats a task a set number of times without having to rewrite it. All statements between the FOR and NEXT command are repeated based on the initial value, the final value and the stepsize. If the STEP portion of the command is not used, it is assumed to be 1. Example: 60 FOR ITEMS=1 TO 20 70 INPUT PRICE 80 SUM=PRICE+SUM 90 NEXT ITEMS RUN FUNCTION A function is a mathematical procedure which when applied to a certain value will give a new value. We call the value in brackets ( ), the argument, and the new value, the result. Example: SQR is a square root function. 50

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

50
SOUND
This is a command to generate a sound note.
SOUND
consists of two functions: frequency and duration
frequency
The frequency of the sound in hertz; a value in the range
0 < frequency parameter < 256
duration
The number of the system clock ticks so the sound lasts; a value in the range
0 < duration parameter < 256
FOR ...
TO ...
STEP ...
NEXT
Line#
FOR
variable = initial value
TO
final value
STEP
stepsize (optional)
Line#
Line#
Line#
Line#
NEXT
variable
The
FOR ...
NEXT
statement repeats a task a set number of times without having to
rewrite it.
All statements between the
FOR
and
NEXT
command are repeated based on
the initial value, the final value and the stepsize.
If the
STEP
portion of the command
is not used, it is assumed to be 1.
Example:
60
FOR ITEMS=1 TO 20
70
INPUT PRICE
80
SUM=PRICE+SUM
90
NEXT ITEMS
RUN
FUNCTION
A function is a mathematical procedure which when applied to a certain value will give
a new value.
We call the value in brackets ( ), the argument, and the new value, the
result.
Example:
SQR
is a square root function.