|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Programming EasyC
I am trying to use a digital I/O on the vex microcontroller to control a spike. Can someone help me with the programming. I understand all the drive functions, but dont understand how to use the digital to turn a spike on and off in easyC.
Thanks |
|
#2
|
||||
|
||||
|
Re: Programming EasyC
I don't know easyC, but I assume you know how to control digital outputs.
Referencing the Users Guide on the Spike product info page, the input cable to the Spike is wired so that the White (or Yellow or Orange) wire is the Forward signal, the Red wire is the Reverse signal, and the Black wire is ground. So you'll need to use two digital outputs and create a cable like such: Code:
,--W \
| R | digital output 1
| B /
/ W----'
to Spike | R----.
\ B--. '--W \
| R | digital output 2
'----B /
W,R,B = White, Red, Black
Hope that answers your question --Ryan |
|
#3
|
|||||
|
|||||
|
Re: Programming EasyC
Using Ryan's wiring the code might look something like this:
Code:
Channel5=Get RxInput (1,5);
Channel6=Get RxInput (1,5);
if (Channel5 == 1) {
// forward
Set Digital Output (1,1);
Set Digital Output (2,0);
} else if (Channel6 == 1) {
// reverse
Set Digital Output (1,0);
Set Digital Output (2,1);
} else {
// stop
Set Digital Output (1,0);
Set Digital Output (2,0);
}
|
|
#4
|
||||
|
||||
|
Re: Programming EasyC
thank you both, i will try this.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EasyC Pro Programming? | Gizmo2417 | General Forum | 6 | 04-02-2008 01:08 |
| EasyC Vex Programming help in RC Mode | tommytalks | Programming | 7 | 06-12-2007 17:36 |
| Programming help. EasyC Vex Robot. | OneCoolDude | Programming | 2 | 02-12-2007 17:54 |
| EDU programming with easyC | SgtMillhouse648 | Programming | 4 | 11-07-2007 15:58 |
| Arrays in Vex Programming Kit EasyC? | gblake | FIRST Tech Challenge | 9 | 12-09-2006 17:05 |