Last active
November 4, 2015 11:41
-
-
Save floogulinc/a7c52c3413a175e539d8 to your computer and use it in GitHub Desktop.
DIO demo module for Toast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package frc.team2879.diodemomodule; | |
import edu.wpi.first.wpilibj.DigitalOutput; | |
import edu.wpi.first.wpilibj.Timer; | |
import jaci.openrio.toast.core.thread.Async; | |
import jaci.openrio.toast.lib.log.Logger; | |
import jaci.openrio.toast.lib.module.IterativeModule; | |
public class RobotModule extends IterativeModule { | |
public static Logger logger; | |
DigitalOutput digitalOut1; | |
@Override | |
public String getModuleName() { | |
return "DIODemoModule"; | |
} | |
@Override | |
public String getModuleVersion() { | |
return "0.0.1"; | |
} | |
@Override | |
public void robotInit() { | |
logger = new Logger("DIODemoModule", Logger.ATTR_DEFAULT); | |
// set digitalOut1 to DIO port 1 on the roboRIO | |
digitalOut1 = new DigitalOutput(1); | |
Async.schedule(() -> { | |
while (true) { | |
digitalOut1.set(true); // set digitalOut1 to true (1.0) | |
Timer.delay(1); // wait for 1 second | |
digitalOut1.set(false); // set digitalOut1 to false (0.0) | |
Timer.delay(1); // wait for 1 second | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment