Go to Post I didn't think it was possible for Dave to be any more cryptic. I was wrong. - IMDWalrus [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 Rating: Thread Rating: 3 votes, 4.33 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-12-2013, 20:21
hasin5 hasin5 is offline
Registered User
None #4777
 
Join Date: Jan 2013
Location: Canada
Posts: 20
hasin5 is an unknown quantity at this point
Beginner FRC Java Programmer - Help

I ama beginner programmer in terms of the Robotics API (WpiLibJ) and I've been studying a bit of it and I came up with this piece of code to drive the robot forward and then have the piston retract and extract with 1 second delays as test. Can someone clarify if this works, and if not, please help me figure out why it doesn't work. It'd also be awesome if someone can reference a FRC Java guide that takes me through the basic procedure of getting me started in learning the API.

Code:

# = placeholder for real value
Code:
RobotDrive theRobot = new RobotDrive(#);
Timer timer = new Timer();
Relay spike = new Relay(#);
Solenoid piston = new Solenoid(#);
Compressor compressor1 = new Compressor(#);

public void autonomous() { //checks code every 50 seconds
        
        theRobot.setSafetyEnabled(false);
        theRobot.drive(-1, 0.0);
        timer.delay(2.0);
        theRobot.drive(0.0, 0.0);
        compressor1.start();
        piston.set(true);
        for (int x = 0; x < 5; x++) {
        spike.set(Relay.Value.kForward);
        timer.delay(1.0);
        spike.set(Relay.Value.kReverse);
        timer.delay(1.0);
        }
        piston.set(false);
        
        
    }

Last edited by hasin5 : 10-12-2013 at 20:27.
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 12:07.

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