Anyone in this group think they are able on helping me out with a little Cybermaster programming issue??
-- Mvh. Morten Trab
-- Svar venligst kun i NG, med mindre det er MEGET vigtigt. Ved mail, slet REMOVE i min adresse.
Web:
Anyone in this group think they are able on helping me out with a little Cybermaster programming issue??
-- Mvh. Morten Trab
-- Svar venligst kun i NG, med mindre det er MEGET vigtigt. Ved mail, slet REMOVE i min adresse.
Web:
"Morten Trab" skrev i en meddelelse news:bp67t9$dk3$ snipped-for-privacy@svr-1.homedir.dk...
I don't know if I can help you, but we can always have a chat (in Danish).
Best Regards, Tine Andersen
snipped-for-privacy@post3.tele.dk
"Tine Andersen" skrev i en meddelelse news:23Itb.34446$ snipped-for-privacy@news000.worldonline.dk...
Du kan da prøve... Det er noget jeg er ved at bygge sammen med min søn, hvor vi skal have lavet noget styrtøj på, men det vil ikke virke som jeg gerne vil have det til...
Det programmeres i Visual Basic, og skal, når man trykker på hhv. højre og venstre knappen i programmet, få den til at dreje styrtøjet mod højre og venstre, og centrere igen når man slipper knappen, men når man trykker kører den et meget kort øjeblik og stopper så, selvom man ikke har aktiveret en af de sensorer der skal stoppe styrtøjet når det er hhv i yderposition og i midterposition...
With legoCont .SetPower "2", 0, 1 .SetRwd "2" .While 9, 1, 3, 13, 1 .On "2" .EndWhile .Off "2" End With
Det er den del af koden der skal centrere styrtøjet når man slipper venstreknappen... Kan du se hvad der er galt i det??
-- Mvh. Morten Trab
-- Svar venligst kun i NG, med mindre det er MEGET vigtigt. Ved mail, slet REMOVE i min adresse.
Web:
Can anyone in this group see the problen in the following Visual Basic program code??
With legoCont .SetPower "2", 0, 1 .SetFwd "2" .While 9, 0, 3, 2, 1 .On "2" .EndWhile .Off "2" End With
It's supposed to turn on engine 2 (the external engine) and keep it running until sensor 0 is activated (sensors 0-2 is on/off sensors, the ones that is delivered with the set) and the turn off the engine... My problem is that it turns on the engine, and then turns it off instantly (it runs ½ second or so) but the sensors aren't (none of them) activated...
Any solution on this issue??
-- Best regards; Morten Trab Web:
Hmm, let's see in the manual...
while Source1, Number1, RelOp, Source2, Number2
Source1 = 9, sensor Number1 = 0, #0 RelOp = 3, Source2 = 2, constant Number2 = 1, #1
So what you are saying is:
While (Sensor 0) 1 On 2 EndWhile Off 2
You haven't shown us your SetSensorMode, maybe the problem is there? A BOOLEAN sensor should be defined as:
.SetSensorMode 0, 1, 0
which would comply with the .while loop (don't trust any defaults!).
Also, are you sure you have connected the sensors to the correct input?
If your CM programs are small, may I recommend using NQC by Dave Baum (sorry, I'm off line while writing, and I don't know the current URL, do a google search, maybe
NQC (Not Quite C) is a programming language for the RCX and CM, it's (as the name implies) like C, but Not Quite. You write your program in any text editor, and then download it to the CM. I find it very good.
Together with the RcxCC (google!
This is the first CM project I and my boys made,
-- Anders Isaksson, Sweden BlockCAD:
"Anders Isaksson" skrev i en meddelelse news:bp8s4i$prb$ snipped-for-privacy@green.tninet.se...
It does.
Tine
"Anders Isaksson" skrev i en meddelelse news:bp8s4i$prb$ snipped-for-privacy@green.tninet.se...
Excactly the way I made it...
Yup...
Right now it's small, but the NQC doesn't support a hardware joystick, as of my knowledge, which I have in mind to couple on the application later on...
Best regards, Morten Trab Web:
Morten, just another idea:
Maybe you have another task that turns the motor off? Remember that more than one task can be running simultaneously, giving contradicting orders to the motor.
-- Anders Isaksson, Sweden BlockCAD:
Try to invert the RelOp, just in case... Try to switch the sensors...
Sorry, I'm out of ideas :-(
No, as NQC programs run fully on the CM (no PC needed), all you have are the standard outputs/inputs. Of course, you *can* use two sensor inputs in RAW mode together with an old analog joystick (have to build the cables yourself), but that doesn't leave much for other inputs.
-- Anders Isaksson, Sweden BlockCAD:
"Anders Isaksson" skrev i en meddelelse news:bpbboo$idv$ snipped-for-privacy@green.tninet.se...
Not understood...
Done that, no change in behavior...
The joystick is to be connected to the PC, and from there remote control the unit...
Best regards, Morten Trab Web:
"Anders Isaksson" skrev i en meddelelse news:bpbbns$ido$ snipped-for-privacy@green.tninet.se...
If I remove the while from the tash, no problems...Just that it doesn't react on the sensors, but the engine keeps running...
The conclusion to this is that the error MUST be in the while sentence....
I've tried to convert the sensors to RAW, and make the sentence react as this:
.while 9,0,0,2,100
which I read as being:
.while sensor(0) > 100
But it's the same...I've done some testing which shows readings of about 550 when the sensor isn't activated and between 50 and 90 when activated...
Best regards, Morten Trab
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.