A printer has many sensors in it to make sure it stops printing whenever there might be a jam, lack of ink, or other malfunction. This project will simulate how a printer could detect a jam in its document feeding system.
Jam/No Jam Scenarios
Parts:
1 – Arduino Uno
1 – L298N Motor Driver
1 – Printer Jam Simulation Setup
1 – 9V Battery
Assorted Wires
Wiring:
Code:
//defining the arduino pins for switches 1,2, and 3
int switch_1 = 1;
int switch_2 = 2;
int switch_3 = 3;
//Arduino pin 13 will be wired to IN3 on the motor driver board
int motor_en = 13;
void setup() {
//define pinmodes
pinMode(switch_1, INPUT_PULLUP);
pinMode(switch_2, INPUT_PULLUP);
pinMode(switch_3, INPUT_PULLUP);
pinMode(motor_en, OUTPUT);
Serial.begin(9600);
}
void loop() {
//read the values of the three limit switches
int sw1 = digitalRead(switch_1);
int sw2 = digitalRead(switch_2);
int sw3 = digitalRead(switch_3);
//&& stands for logical AND and || stands for logial OR if (sw1 == LOW && sw2 == LOW || sw2 == LOW && sw3 == LOW) {
digitalWrite(motor_en, LOW);
}
else
{
digitalWrite(motor_en, HIGH);
}
}