Arduino Jaguar‎ > ‎

Arduino Potentiometer Jaguar

Ok FIRST Robotics Challenge People! Our Team was looking to be able to run a Jaguar without the control system.
This should be useful for testing shooting mechanisms for the 2013 season.

What you need:

An Arduino
A potentiometer (This used a 10k, what matters is the Arduino board 5v available current)
A sizable 12v power supply (At least 20 Watts, 500Watts(12v @ 40A) if you want to run a CIM motor normally. 
A Jaguar and servo and power cables
A motor

Use the ADC input to read from a potentiometer and set the motor speed.
This is good for setting a constant motor speed without a computer.
This does not automatically return to the stopped case like the JagWii does.

Start Code Below here
#include <avr/interrupt.h>
const int jagsigpin = 9;
const int jagpwrpin = 7;
const int jaggndpin = 8;
const int ledpin = 13;
const int buffsize = 3;
const int analogPin = 0;

char mybuffer[buffsize];
int value = 47;

boolean ledstatus = LOW;
void setup()
  //set the PWM frequency to be 122Hz
  TCCR1B = TCCR1B & 0b11111000 | 0x04;
  pinMode(jagsigpin, OUTPUT);
  pinMode(jagpwrpin, OUTPUT);
  pinMode(jaggndpin, OUTPUT);
  pinMode(ledpin, OUTPUT);
  //write 47 to the jaguar to initialize to center stop

int myVal;
void loop(){
  //scale the ADC input 1024 bits to output 20-74
  myVal =  20+ (int)analogRead(analogPin)*(54./1024);
  //display the value to the computer
  //send the value to the jaguar