Go to Post ...never do something because it is comfortable, do something because you WANT to do it. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 24-09-2014, 13:05
panther83 panther83 is offline
Registered User
no team
 
Join Date: Feb 2014
Location: Washington, IL
Posts: 10
panther83 is an unknown quantity at this point
Re: Arduino with Robot-Open programming help

this is our current code, we are trying to hook it up to one of the digital ports on the side car itself instead on directly to the arduino robot shield


Code:
#include <SPI.h>
#include <Ethernet.h>
#include <EEPROM.h>
#include <RobotOpen.h>



/* I/O Setup */
ROJoystick usb1(1); // Joystick #1
ROPWM leftmotorone(1);
ROPWM rightmotorone(0);
ROPWM leftmotortwo(2);
ROPWM rightmotortwo(3);



void setup()
{
/* Initiate comms */
RobotOpen.begin(&enabled, &disabled, &timedtasks);
pinMode(SIDECAR_DIGITAL7, OUTPUT);
}


/* This is your primary robot loop - all of your code
* should live here that allows the robot to operate
*/

void enabled() {
// Constantly update PWM values with joystick values
// Analog sticks feed back values from 0-255
// 255 - usb1.leftY() to invert a drive
leftmotorone.write(255 - usb1.leftY());
rightmotorone.write(usb1.rightY());
leftmotortwo.write(255 - usb1.leftY());
rightmotortwo.write(usb1.rightY());
if (usb1.btnA(1))
digitalWrite(SIDECAR_DIGITAL7, HIGH);
else
digitalWrite(SIDECAR_DIGITAL7, LOW);

}


/* This is called while the robot is disabled
* PWMs and Solenoids are automatically disabled
*/
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();
}
 


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 22:18.

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