Jump to content

Recommended Posts

Posted

i m trying to get lejos to work

everything exept 1 thing is til now good

i can not format my SD

my windows 10 does not see it

i m learing whit the WWW whit some examples

i made this :

	import lejos.hardware.lcd.LCD ;
public class Tank_remote
{
  static EV3IRSensor ir = new EV3IRSensor( SensorPort.S4 ) ;
  static TankRobot tank = new TankRobot() ;
  public static void main( String [] args )
  {
    LCD.drawString( "Tank remote ." , 2 , 3 ) ;
    while ( true )
    {
      tank.delay( 40 ) ;
      byte [] cmd = new byte [ 4 ] ;
      ir.getRremoteComands( cmd , 0 , cmd.length ) ;
      if ( cmd[0] == 1 )
        tank.move( 100 ) ;
      else if ( cmd[0] == 2 )
        tank.move( -100 ) ;
      else if ( cmd[0] == 3 )
        tank.turn( 100 ) ;
      else if ( cmd[0] == 4 )
        tank.turn( -100 ) ;
      else
        tank.tlf() ;
    }
    ir.close() ;
    tank.close() ;
  }
}
	

	import lelos.hardware.* ;
import lejos.hardware.motor ;
import lejos.hardware.port ;
import lejos.hardware.sensor ;
import lejos.robotics.* ;
import lejos.utility.Delay ;
	public class TankRobot
{
  static EV3LargeRegulatedMotor MB =
    new EV3largeRegulatedMotor( MotorPort.B ) ;
  static EV3LargeRegulatedMotor MC =
    new EV3largeRegulatedMotor( MotorPort.C ) ;
  static EV3IRSensor IRS =
    new EV3IRSensor( SensorPort.S4 ) ;
  static SensorMode distMode ;
  static RangeFinderAdapter RFA ;
  static EV3ColorSensor CS =
    new EV3ColorSensor( SensorPort.S1 ) ;
  static ColorAdapter CA ;
  /**
   * TankRobot()
   * constructor
   */
  public TankRobot()
  {
    distMode = IR.getMode( "distance" ) ;
    RFA = new RangeFinderAdapter( distMode ) ;
    CA =  new ColorAdapter( CS ) ;
  }
  /**
   * getColor()
   * @return Color
   */
  public Color getColor()
  {
    return CA.getColor()
  }
  /**
   * getDistance()
   * @return disance in double cm .
   */
  public double getDistance()
  {
    return RFA.range() ;
  }
  /**
   * delay( ms )
   * @param ms : int milliseconds .
   */
  public void delay( int ms )
  {
    Delay.msDelay( ms ) ;
  }
  /**
   * setMotors( b , c )
   * @param b : int set speed motor at port b .
   * @param c : int set speed motor at port c .
   */
  public void setMotors( int b , int c )
  {
    // set motor B
    if ( b < 0 )
    {
      MB.setSpeed( -b ) ;
      MB.backwart() ;
    }
    else if ( b > 0 )
    {
      MB.setSpeed( b ) ;
      MB.forwart() ;
    }
    else MB.flt() ;
    // set motor C
    if ( c < 0 )
    {
      MC.setSpeed( -c ) ;
      MC.backwart() ;
    }
    else if ( c > 0 )
    {
      MC.setSpeed( c ) ;
      MC.forwart() ;
    }
    else C.flt() ;
  }
  /**
   * move( speed )
   * @param speed : set speed both motors same .
   */
  public void move( int i )
  {
    setMotors( i , i ) ;
  }
  /**
   * turn( speed )
   * @param speed : set speed both motors different .
   */
  public void turn( int i )
  {
    setMotors( i , -i ) ;
  }
  /**
   * flt()
   * slow down and stop .
   */
  public void flt()
  {
    setMotors( 0 , 0 ) ;
  }
  /**
   * stop()
   * stop motors .
   */
  public void stop()
  {
    MB.stop() ;
    MC.stop() ;
  }
  /**
   * close()
   * close all motors and sensors .
   */
  public void close() ;
  {
    MB.close() ;
    MA.close() ;
    IRS.close() ;
    CS.close() ;
  }
}
	

does this look good ?

if error's : please point them out

 

  • Jim changed the title to [HELP] Need Help with Lejos
Posted

Hi,

What exactly is the problem? Your Widows 10 doesn't see your SD card? So the problem is more related to Windows than Lejos, right? 

Just to be sure :wink:

Posted

Can you see a drive letter for the SD card in your Windows Disk Management?    You can also try something like SD Card Formatter from SD Association to reformat your SD card. 

Posted

@dr spock + jim :

i tryed SD formater on my old laptop

it does not see my SD

the port is visable in my pc

i see a port but not a thick line whit a part of blue

i hope this is the only problem i have to solve

if i instal lejos the SD help shows a black screen

whit : "no SD card" or somthing like that

Posted

update :

lejos on SD is now good

eclipse on new laptop

eclipse on old laptop not good jet :

google gives differend result's on old and new laptop

verry strange !!

next problem :

if i do eclipse > file > new java project

nothing happens visably

if i do hello wolrd i see my first project

but dont see any code

i can not type in the code window

and can not find where i can enlarge the code font

any help is welkome

Posted

I'm afraid I do need to dive into the world of leJos myself, so I haven't installed Eclipse (yet). 

I will give it a go, but I need to find some time to test it.

Posted

update :

i have lejos SD card

i have eclipse

eclipse has lejos menu

eclipse not showing lejos lib in left part of screen

but only java

i tryed booting my brick whit SD card :

it took a hour and stil led was red

what is my next step ?

Posted

I really need to do some testing with leJos as well. It's so much better to have an actual programming environment, instead of EV3-G.

Posted
10 hours ago, Jim said:

I really need to do some testing with leJos as well. It's so much better to have an actual programming environment, instead of EV3-G.

A little out of topic but lejOS is not the only option for a programming environment. ev3basic has a good IDE and if you are running ev3dev (linux distro for EV3) you can use Microsoft Visual Code as an iDE for several languages, python probably the best supported - or use your favorite iDE like PyCharm and then transfer the program to the EV3 through SSH.

Posted

I have installed ev3basic, which looks cool....but is indeed....basic.

I would love to Visual Studio Code, but I wasn't sure about Python. But maybe it isn't so bad.

It would be really helpful if we have separate topics for the different environments.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...