Untitled Document
Physical Computing - Bezalel, Sem. B 2001
Home Page
Class Home | Class List | Links
Previous
next

Programming 1:

  1. Set up - stamp.exe
  2. PBASIC - the language of the Basic Stamp- the basics
  3. Examples: Blink

DEBUG:

A command that allows you to see the value of a variable inside the stamp editor. Helpful in debugging a program.

B1=12
B2=8
B3=B1+B2
DEBUG B1,B2,B3

Looping:

Enables the program to continue running indefinately. Whitout a loop, your program would run once, then stop.

MYLABLE: 'This sets the label 
	HIGH 2 ' Turn pin 2 on. 
	PAUSE 1000 'Pause for about 1 sec. 
	LOW 2 'Turn pin 2 off 
	PAUSE 1000 'Pause for about 1 sec. 
GOTO MYLABLE 'Sends it back up to top of loop 

IF:

Enables the program to do things depending on the state of other parts of the circuit.

INPUT 3 'make pin3 an input 

MYLABEL: 
	IF IN3 = 1 THEN FLASH 
GOTO MYLABEL:      


FLASH: 
	HIGH 5 
	PAUSE 1000 
	LOW 5 
	PAUSE 1000 
GOTO MYLABEL 

POT:

A command that allows the basic stamp to read the level of a potentiometer (in our case we are using a light sensative Photocell) and put it into a variable.

POT pin,scale,variable

POT 1,100,B1 = read pot in Pin 1, on a scale of 100, and put it into variable B1. B1 call later be tested in an IF statement.