New to the Basic stamp 2
Maintenance man
Posts: 17
Hi to all,
I am new to the Basic stamp 2 in which we are using it in our Mechatronics class to learn some basic microcontroller programming. We are using the book” What’s a Microcontroller ? “student workbook version 1.9 Stamps in Class. I enjoy learning about electronics which includes microcontrollers.We have been working with blinking LEDs and servo motors. At the end of each chapter there are the challenges in which I find very fun. I was wondering if there was a place in this forum that shows some examples of these challenges so I can compare my programs to some other examples that others have done. In the book I am using ,the servo motor controlling starts in chapter 3 in which I would like to see some examples of servo control for the end of chapter challenges for chapters 3, 4, 5 and 6. Thank you all for your help in advance.
Sincerely:
Maintenance Man
I am new to the Basic stamp 2 in which we are using it in our Mechatronics class to learn some basic microcontroller programming. We are using the book” What’s a Microcontroller ? “student workbook version 1.9 Stamps in Class. I enjoy learning about electronics which includes microcontrollers.We have been working with blinking LEDs and servo motors. At the end of each chapter there are the challenges in which I find very fun. I was wondering if there was a place in this forum that shows some examples of these challenges so I can compare my programs to some other examples that others have done. In the book I am using ,the servo motor controlling starts in chapter 3 in which I would like to see some examples of servo control for the end of chapter challenges for chapters 3, 4, 5 and 6. Thank you all for your help in advance.
Sincerely:
Maintenance Man
Comments
Here is what I would do is put what you have as far as the code you have and I am sure there is some on this forum would glad to help you with it
Write a program ( complete with remarks) that will turn on the LED (on P5) every time the servo reaches one extreme of its travel, then turn the LED off when it reaches the other extreme.
This is the program that I have written, which worked ok. Any input would be greatly appreciated; negative or positive input appreciated to help make me a better programmer of the basic stamp 2. I tried to space the remarks from the program when I saved it, but it will not let me space the remarks.from the prgram in this post. Sorry.
' { $TAMP BS2}
x VAR Word 'A variable called X one word long
OUTPUT 12 'Make P12 a output
OUTPUT 5 'Make P5 a output
here: 'A label
FOR x = 1 TO 100 'Beginning of a for...next loop
PULSOUT 12, 500 'Determins the duration of the pulse on output 12
PAUSE 10 'Pause for 10 ms
NEXT 'If x has reached 100 at this stage, the program will continue
LOW 5 'Turn on LED at pin 5
PAUSE 500 'Pause for 500 ms
FOR x = 1 TO 100 'beginning of a for... next loop
PULSOUT 12, 1000 'Determins the duration of the pulse on output 12
PAUSE 10 ' Pause for 10 ms
NEXT 'If x has reached 100 at this stage , the program will continue
HIGH 5 'Turn off the LED at pin 5
PAUSE 500 'Pause for 500 ms
GOTO here 'Go back to the here label and do it all again