The code below, copied from the "digital" example provided with the library should work fine.
Code:
#include <SPI.h>
#include <SD.h>
#include <Ethernet.h>
#include <Servo.h>
#include <EEPROM.h>
#include <RobotOpen.h>
/* I/O Setup */
ROJoystick usb1(1); // Joystick #1
RODigitalIO dig1Out(9, OUTPUT); // DIO channel 9, output mode
void setup()
{
/* Initiate comms */
RobotOpen.begin(&enabled, &disabled, &timedtasks);
}
/* This is your primary robot loop - all of your code
* should live here that allows the robot to operate
*/
void enabled() {
if (usb1.btnA())
dig1Out.on();
else
dig1Out.off();
}
/* This is called while the robot is disabled
* All outputs are automatically disabled (PWM, Solenoid, Digital Outs)
*/
void disabled() {
// safety code
}
/* This loop ALWAYS runs - only place code here that can run during a disabled state
* This is also a good spot to put driver station publish code
*/
void timedtasks() {
RODashboard.publish("Uptime Seconds", ROStatus.uptimeSeconds());
}
// !!! DO NOT MODIFY !!!
void loop() {
RobotOpen.syncDS();
}