PFMate support and I2CSensor

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

Moderators: roger, gloomyandy, skoehler

PFMate support and I2CSensor

Postby mcrosbie » Sat Dec 28, 2013 11:41 pm

I've been having great success getting 0.5.0 alpha working on my EV3, and also have Eclipse running the ev3tools perfectly on my Mac over both BLuetooth nd wifi. Good job everyone getting this release out!

I'd like to use a Mindsensors PFMate with the EV3 to control some PF motors. The Mindsensors website says the PFMate is not supported on the EV3 so I was wondering if the leJOS code supports it or if this is a restriction in the underlying Lego firmware? I tried doing a basic test using I2CSensor, but nothing gets printed for the I2C Version, Vendor ID and Product ID.

Am I just out of luck on this one?

Thanks,
Mark

Code: Select all
    public static void main(String[] args) {
       System.out.println("Starting I2CSensor Test...");
        LCD.clear();
        LCD.drawString("Sensor test", 0, 3);
 
        I2CSensor s;
       
        System.out.println("Plug sensor into port 1");
       
        Delay.msDelay(1000);
       
        s = new I2CSensor(SensorPort.S1);

        System.out.println("Address: " + s.getAddress());
        System.out.println("Product ID: " + s.getProductID());
        System.out.println("Vendor ID: " + s.getVendorID());
        System.out.println("Version: " + s.getVersion());
       
        System.out.println("Done");
    }
mcrosbie
Novice
 
Posts: 25
Joined: Wed Mar 24, 2010 12:27 pm
Location: Dublin, Ireland

Re: PFMate support and I2CSensor

Postby gloomyandy » Sun Dec 29, 2013 8:21 am

Have you tried using the driver that is part of the 0.5.0-alpha release?
https://sourceforge.net/p/lejos/ev3/ci/ ... FMate.java
Note that this may not work as we are not in a position to test all hardware (we simply don't have every device).
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3881
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: PFMate support and I2CSensor

Postby mcrosbie » Mon Dec 30, 2013 12:29 pm

Hi Andy,

My initial test program for the PFMate class was the problem because it seems to work nicely now (I gave it a stern talking-to last night). This little piece of code drives the motors back and forward perfectly. It seems to need a little delay between sending command to each PF motor port.

Code: Select all
import lejos.hardware.Button;
import lejos.hardware.Sound;
import lejos.hardware.device.PFMate;
import lejos.hardware.lcd.*;
import lejos.hardware.port.SensorPort;
import lejos.utility.DebugMessages;
import lejos.utility.Delay;

public class PFMateTest {

   private static PFMate pfObj;
   private static final int PFDelayCMD = 50; //ms.

   public static void main(String[] args){
      pfObj = new PFMate(SensorPort.S1,1);

      pfObj.A.setSpeed(3);
      pfObj.B.setSpeed(3);

      Sound.beep();
      
      LCD.clear();
      LCD.drawString("PFMateTest", 0, 0);

      while(Button.ENTER.isUp()){
         LCD.clear(2);
         LCD.drawString("Forward", 0, 2);
         pfObj.A.forward();
         Delay.msDelay(PFDelayCMD);
         pfObj.B.forward();
         Delay.msDelay(1000);
         LCD.clear(2);
         LCD.drawString("Reverse", 0, 2);
         pfObj.A.backward();
         Delay.msDelay(PFDelayCMD);
         pfObj.B.backward();
         Delay.msDelay(1000);
      }
         
      System.exit(0);
   }
}
mcrosbie
Novice
 
Posts: 25
Joined: Wed Mar 24, 2010 12:27 pm
Location: Dublin, Ireland


Return to EV3 Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff