Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp — Parallax Forums

basic stamp

mazmaz Posts: 5
edited 2011-02-09 23:26 in BASIC Stamp
or my project paper...im use accelerometer sensor(x and y axis) to control the rotation of standard servo motor...kindly apply to disable people that have problem with a movement..the accelerometer sensor is attached on the headset...and webcam is attached to the motor..when the user turn their head for example 10 degree to the left...so the sensor also turn 10 degree left..then..the standard servo motor also will turn to 10 degree of rotation to the left..now i want to know the exactly value of the sensor n motor..its is true that the sensor and motor turn to the 10 degree...because of that i want transmit all data in the bs2 microcontroller to my hyperterminal in my pc..my question is?

1)i need to add some command n setting up my hyperterminal rite?what is the command?
2)its is true that i need to do a serial communication circuit by using max232?
3) how i want to see all the programming in the mircocontroller in the basic stamp software?

and for the standard servo motor..this my question...
1) the center position of the motor is 750 for x axis and 650 for y axis? if im use 720 and 650 its can be the center position?what is means by the bs2 1.3ms is 650...1.5ms is 750 and 1.7ms is 850...

above i attached together with my programming..i hope u can help me asap because im not good in programming

{$STAMP BS2}

Xin CON 6 ;for left right turn
Yin CON 7 ;for foward and backward

HiPulse CON 1 ; QUESTION:::>> what the function of hipulse anf LoPulse??
LoPulse CON 0
DegSym CON 176

pulse VAR Word
xmg VAR word
ymg VAR word
temp1 VAR Word ;QUESTION>>> can i change the temp1,temp1old,temp2,temp2old and temp21 to another word??
temp1old VAR Word
temp11 VAR byte
temp2 VAR Byte
temp2old VAR Word
temp21 VAR Byte
j VAR Byte ;QUESTION>>>> can i change the j to another word??
diffx VAR byte
diffy VAR Byte
'

main:

temp1old=0
temp2old=0

DO:

FOR j = 0 to 20 ; center position for motor ::QUES>>>>its fixed the value 0 to 20??
PULSOUT 8, 720
PULSOUT 9, 650
PAUSE 20
NEXT

CHECK:

IF IN0 = 1 THEN BUZZ

GOSUB read_G_force ::QUES>>>>can i can change the name of G-force??
temp1 = ABS xmg/10 ; for degree x-axis
temp11 = ABS xmg.BIT15 ; for left or right
temp2 = ABS ymg/10 ; for degree y-axis
temp21 = ABS ymg.BIT15 ; for backward or foward

diffx = ABS (temp1-temp1old) ;;QUES>>> why we should to subtract the current value(temp1) with the exsiting value(temp1old)??
diffy = ABS (temp2-temp2old)

IF (ABS diffx <5) THEN CHECK
IF (ABS diffy <5) THEN CHECK

IF temp11 = 0 THEN left
IF temp11 = 1 THEN right

GOTO DO
END

Read_G_Force:
PULSIN Xin, HiPulse, pulse
Pulse = pulse*/Scale
xmG = ((pulse/100)-500)*8

PULSIN Yin, HiPulse, pulse
Pulse = pulse*/Scale
ymG = ((pulse/100)-500)*8

RETURN

Left:

FOR j = 0 TO 10 STEP 1
PULSOUT 8, 720 - (diffx*2)
PAUSE 10
NEXT

IF temp21 = 0 THEN forward
IF temp21 = 1 THEN backward

GOTO check

right:

FOR j = 0 TO 10 STEP 1
PULSOUT 8, 720 + (diffx*2)
PAUSE 10
NEXT

IF temp21 = 0 THEN forward
IF temp21 = 1 THEN backward

GOTO check

forward:

FOR j = 0 TO 10 STEP 1
PULSOUT 9, 650 + (diffx*2)
PAUSE 10
NEXT

GOTO check

backward:

FOR j = 0 TO 10 STEP 1
PULSOUT 9, 650 - (diffx*2)
PAUSE 10
NEXT

GOTO check

buzz:

FOR j = 0 TO 10
TOGGLE 10 ;QUES>>>what is means by TOGGLE?
PAUSE 300
NEXT
LOW 10
GOTO check

Comments

  • mazmaz Posts: 5
    edited 2011-02-07 08:23
    to someone know this problem..plzzhelp me
  • mazmaz Posts: 5
    edited 2011-02-07 08:39
    its nobody noe about this????
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-07 08:59
    Start by reading the manual and the "What's a Microcontroller?" tutorial. They're available in a variety of languages here and here. Parallax has spent a lot of effort putting together introductory guides. They're very well done. Start with those and then come back with any unanswered questions.
  • mazmaz Posts: 5
    edited 2011-02-07 17:38
    thanx a lots for your guide..
    may i ask u this question..
    if wanna to know the programming inside the ic can or not?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-07 17:54
    I'm not sure I understand your last question.

    It is not possible to get the program out of the Stamp once you have programmed it. There are techniques to get part of the program out in compiled form, but not all of it. In compiled form, a lot of the information is missing like labels and variable names. Some of the statements are converted into simpler forms and the more complex form cannot be recreated (like DO / LOOP ... this gets converted to IF / THEN and GOTO).
  • bsnutbsnut Posts: 521
    edited 2011-02-08 02:33
    I am going to expand on Mike's first post. What you to do is to start with the demo programs for the accelerometer and the servos.
  • mazmaz Posts: 5
    edited 2011-02-09 05:46
    mike green: thanx for ur guide

    bsnut: im already try it but when the data come out in the debug terminal...is shown so big number..like 5565...it count from the xmG formula..means that its is in pulse value of the accelerometer or not?
  • bsnutbsnut Posts: 521
    edited 2011-02-09 23:26
    I have one question for you. Are you using the demo program for the accelerometer? You can also post the demo program for the accelerometer so we can help you better.
Sign In or Register to comment.