A rocker switch is a type of on/off switch that toggles between two positions, resembling a seesaw motion. It is named for its rocking mechanism, which allows users to press one side to close the circuit (on) and the other to open it (off). Rocker switches are widely used in various applications, including household appliances, automotive, industrial controls, and consumer electronics, due to their ease of use and reliability.
Pin Number | Description | Note |
---|---|---|
1 | Input/Line Terminal | Connects to the power source |
2 | Output/Load Terminal | Connects to the device being powered |
3 | Ground Terminal | Only present in illuminated switches |
Note: The pin configuration may vary depending on the type of rocker switch (e.g., SPST, SPDT, DPDT). The above table is for a basic SPST rocker switch.
Q: Can I use a rocker switch with a higher rating than needed? A: Yes, using a switch with a higher rating is generally safe. However, it should not be lower than the circuit's requirements.
Q: Are rocker switches suitable for outdoor use? A: Unless specifically rated for outdoor or waterproof applications, standard rocker switches should be used indoors.
Q: How do I know if my rocker switch is on or off? A: Many rocker switches have an "I" and "O" symbol to indicate the on and off positions, respectively.
This example demonstrates how to use a rocker switch to control an LED with an Arduino UNO.
// Define the pin numbers
const int ledPin = 13; // LED connected to digital pin 13
const int switchPin = 7; // Rocker switch connected to digital pin 7
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
pinMode(switchPin, INPUT); // Set the switch pin as an input
}
void loop() {
// Read the state of the rocker switch
int switchState = digitalRead(switchPin);
// Turn the LED on if the switch is in the 'on' position
if (switchState == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
Note: Ensure that the rocker switch is connected to the switchPin with appropriate pull-up or pull-down resistors as needed.
This documentation provides a comprehensive overview of the rocker switch, its technical specifications, usage instructions, and troubleshooting tips. It also includes an example code snippet for interfacing with an Arduino UNO, which can be adapted to various other microcontroller platforms.