Shop OBEX P1 Docs P2 Docs Learn Events
Help!! — Parallax Forums

Help!!

torkrolltorkroll Posts: 2
edited 2008-01-07 00:13 in Propeller 1
hello .
·having trouble with some code . it is for fying an rc aircraft . it detects the pwm on pin 8 and depending on the mesured width it either passes signals from pin 4 to 7 onto pin 0 to 3. or take readings from ·H48C Tri-Axis Accelerometer and move a servo accordingly. everthing works good but it wont·switch from pass to accelerometer mode. it switches from accel' to pass mode but not the other way.

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2008-01-06 23:27
    At the first glance it seems very likely you try to activate too many COGs. You do not check whether a COGNEW really succeeds...
  • torkrolltorkroll Posts: 2
    edited 2008-01-06 23:34
    is it from this repeat loop ?

    pub readdata |z

    Debug.start(31, 30, 0, 57600)

    repeat
    X := BS2.PULSIN_uS(8,1) ' Measure time PWM high for


    if x < 1500
    pass.stop
    coglvl := cognew(le_vel,@stack2)
    else
    cogstop(coglvl~ - 1)
    pass.start



    WD1_Flag:=1 ' Set Watch dog flag
    WD1_Timer := 100 ' Set timeout period, re-intialize each pass
    z:= BS2.PULSIN(19,1) ' Get/wait for pulse
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-07 00:13
    Maybe - it's just the total number of COGNEWS (explicite or hidden in library objects) that is tremendious..
Sign In or Register to comment.