Issue for 9V Micromotor

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

User avatar
Jeremy1980
Novice
Posts: 47
Joined: Wed Mar 30, 2016 8:57 pm
Location: Poland
Contact:

Issue for 9V Micromotor

Postby Jeremy1980 » Sun May 07, 2017 10:26 am

This
9V Micromotor work correctly. Take motor into motion:

Code: Select all

NXTRegulatedMotor myBMotor = new NXTRegulatedMotor(EV3Brick.getPort("B"));
myBMotor.forward();

But If i use this

Code: Select all

Port p = EV3Brick.getPort("B");
DeviceIdentifier motor = new DeviceIdentifier(p);

I get 126 as response from motor.getPortType() or motor.getDeviceType()

User avatar
gloomyandy
leJOS Team Member
Posts: 5867
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Issue for 9V Micromotor

Postby gloomyandy » Thu May 11, 2017 9:09 pm

I have already answered the question you asked about this motor in the following thread...
viewtopic.php?f=18&t=8779&p=32001#p32001

What makes you think that it should be possible to identify this type of motor? Does the LEGO Software identify it?
leJOS news https://lejosnews.wordpress.com/

User avatar
gloomyandy
leJOS Team Member
Posts: 5867
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Issue for 9V Micromotor

Postby gloomyandy » Fri May 12, 2017 10:24 pm

Oh and it does not really make sense to use a RegulatedMotor class with this type of motor as it does not have a tachometer. Better to use the UnregulatedMotor class to control it.
leJOS news https://lejosnews.wordpress.com/

User avatar
Jeremy1980
Novice
Posts: 47
Joined: Wed Mar 30, 2016 8:57 pm
Location: Poland
Contact:

Re: Issue for 9V Micromotor

Postby Jeremy1980 » Fri May 19, 2017 11:50 am

Code: Select all

       
1       drawMessage("Processing...");
2           myBMotor.forward();
3          
4           Button.LEDPattern(5);
4           do {
6              myS3Provider.fetchSample(sample, 0);
7              if (Math.round(sample[0]) == 1) { myBMotor.stop(); myBMotor.backward(); }
8              
9              myS2Provider.fetchSample(sample, 0);
10              if (Math.round(sample[0]) == 1) { myBMotor.forward(); }
11              
12              drawMessage("Queue "+String.valueOf(queue));
13              Delay.msDelay(100);
14           }
15           while (queue < queueMax); 
16           myBMotor.stop(true);
17           myBMotor.resetTachoCount();
18          
19           drawMessage("Waiting...");
20           Button.LEDPattern(3);   
21           myAMotor.rotate(360);


myBMotor and myAMotor is instance of NXTRegulatedMotor.
myAMotor is connected to eV3 medium motor
myBMotor is connect to 9V Micromotor

After 15 line, this code not work. I can stop 9V Micromotor only exit app or use close() method on it. stop() method do not affect this device.
What I should do ??

User avatar
gloomyandy
leJOS Team Member
Posts: 5867
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Issue for 9V Micromotor

Postby gloomyandy » Fri May 19, 2017 1:51 pm

You can't use a regulated motor class with a micro motor, the micro motor does not have a tachometer which is required by the regulated motor class. I've already told you this several times, you need to use the UnregualtedMotor class to control it.
leJOS news https://lejosnews.wordpress.com/


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 3 guests