View Single Post
  #3   Spotlight this post!  
Unread 03-02-2014, 11:43
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 747
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: LED Programming ? Help Please.

Our programming team is doing the same thing. Here is the advice I gave them.

There are two parts to this.
PART #1. Programming the LED lights to do what you want. Like light "behaviors" let's call them.
PART #2. Interfacing the CRIO to "trigger" the arduino to run a behavior.

Part #1 should consist of you writing code in the arduino to make your LED lights do what you want them do to.
For example write down the behaviors.
1. Robot is idle
2. Robot is shooting
3. Robot has the ball
Now write the code to make the LED lights do what you want for each behavior, then place them into a while loop with a CASE SELECT structure.

CASE 0
Robot is idle
CASE 1
Robot is shooting
CASE 2
Robot has the ball

etc...

Part #2 is setting up, wiring and programming an interface in the CRIO...
There are three INTERFACING suggestions I can suggest.

SIMPLE INTERFACE
Wiring the output pin of the CRIO to the INPUT pin on the arduino.
Map the CASE SELECTs to a digital input on the arduino.
Then in the LABVIEW program, just turn on a digital output that is wired directly to the arduino.

IN1 = trigger idle state
IN2 = trigger robot shooting
IN3 = trigger robot has the ball

This interfacing method is called discret wiring I/O. It's the simplest interface of the THREE interface suggestions I have for you below.

INTERMEDIATE INTERFACE
A stepup from that would be to do a BCD (binary coded decimal) ENCODE from the CRIO to a DECODE in the arduino. The advantage is you can have 8 robot behaviors with only three wires connected. It's technically the same as discret, however you're not chewing up a bunch of wires to get more behaviors.

Wiring I/O on the Digital Sidecar sample.
(least signaficate bit on right)
BINARY VALUE 4, 2, 1, etc...

IN3, IN2, IN1
0,0,0 = 0 decimal
0,0,1 = 1 decimal
0,1,0 = 2 decimal
0,1,1 = 3 decimal
1,0,0 = 4 decimal
1,0,1 = 5 decimal
1,1,0 = 6 decimal
1,1,1 = 7 decimal

ADVANCED INTERFACE
One more suggestion would be to write an I2C interface.

In this case, you will need to include the wire library and setup a SLAVE ADDRESS to the arduino and have the CRIO become the MASTER and set memory bits.

http://arduino.cc/en/reference/wire

So first you have to decide how you want to interface the two processors together. That's the root decision you need to make first.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369

Last edited by Chris_Elston : 03-02-2014 at 11:45.
Reply With Quote