To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1784
1783  |  1785
Subject: 
Re: Swan firmware crash!
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 20 Jul 2005 08:07:24 GMT
Viewed: 
6508 times
  
In lugnet.robotics.rcx.nqc, Daniele Benedettelli wrote:
You haven't given us(readers) much to go on. I had a similair problem but
finding the solution was a bit of a fluke.

If you could provide some info like program size, and a description of what the
program does or some code we may have more luck in identifying the problem.

Steve

* Maybe I wasn't too clear, but really there isn't much to say: it is the
SetMotorPower128 command that causes the error.
* Another question is: why costants MTR_A or MTR_B don't work at all?


Here's the code(all the code):


task main{
  SetMotorPower128(MTR_A,100);
  SetOutput(MTR_A,OUT_REV);
  Wait(300);
  Off(MTR_A);
}

You can see that specifying all the code is quite unuseful:it's just a banal
test code!

That's where your completely wrong. I can see the error, calls to motor power
should be set out like this

    motorPower128(1) = MyVariableName;

in this example the constant "1" means set the power to output B to the value
specified by MyVariableName. Output A would be 0 and C would be 2.

You may also need to add a line like

#include "C:\WINDOWS\Desktop\Lego\SWAN\swan.nqh"

but you'd have to rewrite it to point to your copy of swan.nqh.

Hope that helps.

Steve



Message has 2 Replies:
  Re: Swan firmware crash!
 
(...) Here is Bricxcc help about those commands: SetMotorPower128(const int motor, const int &v) Function - Swan Set the power of a motor to the specified value (using a scale from 0 to 127). SetMotorPower128(MTR_A, 100); ___...___ (...) (19 years ago, 20-Jul-05, to lugnet.robotics.rcx.nqc)
  Re: Swan firmware crash!
 
(...) This is the old-style Swan API which is deprecated. The Swan API built into NQC uses MotorPower128(n) and SetMotorPower128(n, m). With the latest version of NQC you no longer need to include the old swan.nqh header file. The old swan.nqh file (...) (19 years ago, 21-Jul-05, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Re: Swan firmware crash!
 
(...) * Maybe I wasn't too clear, but really there isn't much to say: it is the SetMotorPower128 command that causes the error. * Another question is: why costants MTR_A or MTR_B don't work at all? Here's the code(all the code): task main{ (...) (19 years ago, 20-Jul-05, to lugnet.robotics.rcx.nqc)

23 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR