A rocker switch is a type of on/off electrical switch that operates by rocking between two positions. This action either allows the current to flow through the switch or interrupts the circuit, effectively turning the connected device on or off. Rocker switches are commonly used in household appliances, automotive applications, industrial controls, and consumer electronics due to their ease of use and reliability.
Pin Number | Description | Notes |
---|---|---|
1 | Input/Line Terminal | Connect to power supply |
2 | Output/Load Terminal | Connect to the device or load |
Note: The pin configuration may vary for DPST and other variations of rocker switches.
Switch Does Not Operate:
Intermittent Operation:
Q: Can I use a rocker switch with a DC load? A: Yes, rocker switches can be used with DC loads, but ensure the switch's DC ratings are appropriate for your application.
Q: How do I know if my rocker switch is on or off? A: Many rocker switches have an indicator line or color on one side to signify the "on" position.
Q: Is it safe to change the rocker switch while the power is on? A: It is always recommended to turn off the power before working on electrical components to ensure safety.
If you're using a rocker switch to control a device with an Arduino UNO, here's a simple example code that demonstrates how to read the state of the rocker switch.
// Define the pin connected to the rocker switch
const int rockerSwitchPin = 2;
void setup() {
// Set the rocker switch pin as an input
pinMode(rockerSwitchPin, INPUT);
// Initialize serial communication at 9600 bits per second
Serial.begin(9600);
}
void loop() {
// Read the state of the rocker switch
int switchState = digitalRead(rockerSwitchPin);
// Print the state of the switch to the Serial Monitor
Serial.println(switchState);
// Add a small delay to prevent bouncing issues
delay(50);
}
Note: In this example, the rocker switch is connected to digital pin 2. One terminal of the switch is connected to the pin, and the other terminal is connected to ground. The internal pull-up resistor is used to ensure a default high state when the switch is open.