Go to Post Valentine's day, who has time for Valentine's day?????? I have code to write!! - paulcd2000 [more]
Home
Go Back   Chief Delphi > Technical > Control System > FRC Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
  #31   Spotlight this post!  
Unread 04-08-2009, 02:37
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Driver Station Usb

simple test program for arduino which i am using for the pots right now

Code:
#include <Wire.h>

void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
}

byte value = 0;
byte ch1 = 0x28;
byte ch2 = 0x29;
byte pot1 = 0xA9;
byte pot2 = 0xAA;

void loop()
{
 writePot(ch1, pot1, value);
 writePot(ch1, pot2, value);
 writePot(ch2, pot1, value);
 writePot(ch2, pot2, value);

  value++;        // increment value
  if(value == 256) 
  {
    value = 0;    // start over from lowest value
  }
  delay(100);
}

void writePot(int chip, int pot, int val)
{
  Wire.beginTransmission(chip); // transmit to device 0x28)
  Wire.send(pot);            // sends instruction byte,
                               // write to potentiometer-0
  Wire.send(val);             // sends potentiometer value byte
  Wire.endTransmission();     // stop transmitting
}
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #32   Spotlight this post!  
Unread 04-08-2009, 19:18
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Driver Station Usb

here is the code for the arduino, the touchscreen has its own processor that talks over ttl serial to the arduino
the arduino takes the output from the screen to the DS io pins

Code:
#include <Wire.h>
#include <AFSoftSerial.h>
#define rxPin 3
#define txPin 2

AFSoftSerial touchscreen = AFSoftSerial(rxPin, txPin);

byte ch1 = 0x28;
byte ch2 = 0x29;
byte pot1 = 0xA9;
byte pot2 = 0xAA;

int stopPin = 4, newData = 5, validRx = 6;

void setup()
{
  pinMode(rxPin, INPUT);//set recieve as an input
  pinMode(txPin, OUTPUT);//set transmit as an output
  pinMode(stopPin, OUTPUT);
  pinMode(newData, OUTPUT);
  pinMode(validRx, INPUT);
  touchscreen.begin(9600);
  Wire.begin(); // join i2c bus (address optional for master)
}

int points = 0;
bool stop = false;

void loop()
{
   int x = 0, y = 0;
   boolean recieved = digitalRead(validRx);
   boolean changePoint = touchscreen.available() >= 2 
               && (recieved || points == 0)
               && !stop;
   
   if(stop){
     digitalWrite(newData, LOW);
     digitalWrite(stopPin, HIGH);
   }            
   
   if(recieved){
       digitalWrite(newData, LOW);
       delay(100);
   }
   
   if(changePoint)
   {
     x = touchscreen.read();
     y = touchscreen.read();
     if(touchscreen.available() == 1 && touchscreen.read() == 's')
           stop = true;
           
     points++;
     
     if(points >= 50) 
          stop = true;
       
     writePot(ch1, pot1, x * 2);
     writePot(ch1, pot2, y * 2); // 
     writePot(ch2, pot1, points * 5); // point num
     digitalWrite(newData, HIGH);
   }   
   
}

void writePot(int chip, int pot, int val)
{
  Wire.beginTransmission(chip); // transmit to device 0x28)
  Wire.send(pot);            // sends instruction byte,
                               // write to potentiometer-0
  Wire.send(val);             // sends potentiometer value byte
  Wire.endTransmission();     // stop transmitting
}
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #33   Spotlight this post!  
Unread 05-08-2009, 20:50
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Driver Station Usb

digi pots on breadboard, just waiting to be soldered
Attached Thumbnails
Click image for larger version

Name:	noname (1).jpg
Views:	31
Size:	5.0 KB
ID:	8053  
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #34   Spotlight this post!  
Unread 12-08-2009, 01:32
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Driver Station Usb

now all thats missing is the screen and prototyping shield

The Pwm wires plug into the drivers station, which go to a db9 connector. the db9 is used so that the drivers dont have to unplug the PWMs to take it out of the box for strategy planning. because i would imagine that the pwms could get plugged in incorrectly and fry the screen
Attached Thumbnails
Click image for larger version

Name:	Robot 084.jpg
Views:	34
Size:	134.7 KB
ID:	8054  
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!

Last edited by biojae : 12-08-2009 at 14:48.
Reply With Quote
  #35   Spotlight this post!  
Unread 12-08-2009, 18:45
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Driver Station Usb

The Pwm cords go to the driverstation, the serial port to the screen

(and i just noticed how far away from USB I've gotten, the title is definatly incorrect)

The parts are definatly shipped
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!

Last edited by biojae : 12-08-2009 at 22:59.
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Driver Station S.O.S. M. Gildner Electrical 15 28-11-2009 19:35
Driver Station dnrobotics11 Control System 2 18-02-2009 21:35
driver station does not recognize usb 3 or 4... aksharma Technical Discussion 0 07-02-2009 12:57
Driver station only regognizes USB 1 and 2 cvxdes Programming 14 05-02-2009 14:40


All times are GMT -5. The time now is 11:13.

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