-
Notifications
You must be signed in to change notification settings - Fork 2
Relay
You can use the onboard relay switch to control on/off devices that consumer more current than can be supplied by simply turning a digital pin on and off.
The way the relay works is that it switches between connecting a common center pin to one of the two outer pins (State 1 or State 2). So if, for example, you wanted to trigger a solonoid, you'd connect the solonoid's V+ pin to the center pin, and connect State 1 to APM's V+ and State 2 to Ground. In State 1, the solonoid would go on; in State 2 it would go off.
http://ardupilot-mega.googlecode.com/svn/ArduPilotMegaImages/relay.jpg
You script it into missions with any GCS. Here are the commands in the Mission Planner:
http://ardupilot-mega.googlecode.com/svn/ArduPilotMegaImages/relayset.png
Here's some code that demonstrates it switching from one position to another.
{
pinMode(RELAY_PIN,OUTPUT);
while(1){
delay(3000);
Serial.println("Relay Position A");
PORTL |= B00000100;
delay(3000);
Serial.println("Relay Position B");
PORTL ^= B00000100;
}
}