Go to Post I hope that all of our new members are as helpful as the one above. We will be in for an amazing season if that is the case. - Greg Needel [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 15-01-2016, 15:52
JoelRummel JoelRummel is offline
Registered User
FRC #4855
 
Join Date: Jan 2016
Location: South Haven, MI
Posts: 7
JoelRummel is an unknown quantity at this point
Defining/Setting a motor in Java

I am trying to run a VERY SIMPLE piece of Java.
Its only goal is to set a motor's speed to 0.5.
Yet I have difficulties with even this simple task:
Code:
package org.usfirst.frc.team4855.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Talon;

public class Robot extends IterativeRobot {

	Talon talonMotor;

    public void robotInit() {

    	talonMotor = new Talon(0);
    	
    }

    public void teleopInit(){

    	talonMotor.set(0.5);

    }
Not only does this not work but I get a whole bunch of crap in the driver station:

ERROR Unhandled exception: java.lang.RuntimeException: Code: -1029. HAL: Resource already allocated at [edu.wpi.first.wpilibj.hal.PWMJNI.allocatePWMChanne l(Native Method), edu.wpi.first.wpilibj.PWM.initPWM(PWM.java:117), edu.wpi.first.wpilibj.PWM.<init>(PWM.java:134), edu.wpi.first.wpilibj.SafePWM.<init>(SafePWM.java: 35), edu.wpi.first.wpilibj.Talon.<init>(Talon.java:51), org.usfirst.frc.team4855.robot.Robot.robotInit(Rob ot.java:31), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]
WARNING: Robots don't quit!

Give it enough time and the robot will just reach an emergency stopped state without any apparent reason.

What in the world am I doing wrong
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi