Go to Post *When putting grease on anything* "The bigger the glob the better the job." - TheMagicPenguin [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-04-2015, 21:43
VijayAT VijayAT is offline
Registered User
FRC #4901
 
Join Date: Apr 2015
Location: United States
Posts: 1
VijayAT is an unknown quantity at this point
Victor 888 by Arduino Uno R3

This is not an FRC or FIRST related project.

I'm using a Victor 888 and an Arduino Uno R3 to power a BAG motor through PWM. I'm using a FIRST battery.

I found this sample code on Arduino's forums:
#include <SoftwareServo.h>

SoftwareServo servo1;
SoftwareServo servo2;

void setup()
{
pinMode(9,OUTPUT);
servo1.attach(2);
servo1.setMaximumPulse(2200);
servo2.attach(4);
servo2.setMaximumPulse(2200);
Serial.begin(9600);
Serial.print("Ready");
}

void loop()
{
static int value = 0;
static char CurrentServo = 0;

if ( Serial.available()) {
char ch = Serial.read();
switch(ch) {
case 'A':
servo1.attach(2);
CurrentServo='A';
digitalWrite(13,LOW);
break;
case 'B':
servo2.attach(4);
CurrentServo='B';
digitalWrite(13,HIGH);
break;
case '0' ... '9':
value=(ch-'0')*20;
if (CurrentServo=='A')
{
servo1.write(value);
}
else if (CurrentServo=='B')
{
servo2.write(value);
}
break;
}
}
SoftwareServo::refresh();
}

and this from another Chief Delphi post:

//Simple VEX Pro Victor 888 Driver

unsigned short pin = 9;

signed int dutyCycle = 0;
unsigned int highus = 1500;
unsigned int lowus = 1000;

void setup() {
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
Serial.begin(9600);
}

void loop() {
digitalWrite(pin, HIGH);
delayMicroseconds(highus);
digitalWrite(pin, LOW);
delayMicroseconds(lowus);

if (Serial.available() > 0) {
highus = 5*Serial.parseInt() + 1500;
lowus = 1000;
Serial.print("DS: "+dutyCycle);
}
}

I have a VEX Pro VersaPlanetary 10:1 Gearbox and I need the motor to run at 600 RPM, so I can get 60 RPM from the gearbox. I've also looked through Arduino's servo library. Any advice?
  #2   Spotlight this post!  
Unread 27-04-2015, 22:03
JNajarian JNajarian is offline
Alumni
FRC #0696
Team Role: College Student
 
Join Date: Nov 2012
Rookie Year: 2012
Location: United States
Posts: 6
JNajarian will become famous soon enough
Re: Victor 888 by Arduino Uno R3

Try something like this just to test if your electrical setup works.
Code:
#include <Servo.h>
Servo victor1;
void setup(){
    victor1.attach(2);
}
void loop(){
    victor1.write(180);//0 being full backwards 90 being no motion and 180 being full forwards
}
Last time I used a Victor with an Arduino was about two years ago, I don't have the equipment to test this code right now, but this is essentially what I used to run it.
  #3   Spotlight this post!  
Unread 27-04-2015, 23:21
teslalab2's Avatar
teslalab2 teslalab2 is offline
RogueBotix LLC
VRC #8091
Team Role: Mentor
 
Join Date: Feb 2015
Rookie Year: 2014
Location: Austin MN
Posts: 109
teslalab2 will become famous soon enoughteslalab2 will become famous soon enough
Re: Victor 888 by Arduino Uno R3

I wrote I library for jaguars and victors (though I haven't actually tried it with victors)

in header:
#include "Victor.h"
Victor mycontroller;

void setup()

mycontroller.SetPort(pinnum,true/false) //the boolean is for if its reversed or not.

void loop

mycontroller.Set(from -1 to 1)


this might only work on pin 3,5,6,11, like I said I haven't tried it because I don't own any victors. but if you want it here you go , and you will probably have to recalibrate the controller.
Attached Files
File Type: zip Victor.zip (1.6 KB, 17 views)
__________________
I need a jaguar development board for reprogramming a jaguars bootloader. if you have one that you want to sell, pm me. thanks

Run you CanJaguars on arduino with ArduRIO, you can also easily control Talons, Victors,Jaguars and Sparks on PWM. https://sourceforge.net/projects/ardurio/

Last edited by teslalab2 : 27-04-2015 at 23:25.
  #4   Spotlight this post!  
Unread 28-04-2015, 00:54
asid61's Avatar
asid61 asid61 is offline
Registered User
AKA: Anand Rajamani
FRC #1072 (MVRT)
Team Role: Mechanical
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Cupertino, CA
Posts: 2,231
asid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond repute
Re: Victor 888 by Arduino Uno R3

I was just about to look for code like this this morning, to see how much processing we can move offboard to an XMOS (just for kicks). Thank you!
Closed Thread


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 02:15.

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