Question: Write an Arduino program (using PORT,PIN,DDR) for the following question: A door (active low) is connected to bit 1 of Port B, and an alarm
Write an Arduino program (using PORT,PIN,DDR) for the following question:
A door (active low) is connected to bit 1 of Port B, and an alarm is connected to bit 7 of Port C. Write a program to monitor the door sensor and, when it is active, turn on the alarm.
// if door is active low turn on alarm
void setup(){
//initialize the port pins for inputs and outputs
//enable pull-ups if needed
//default the alarm to off
} //setup
void loop(){
// check if the door sensor is active. If so, turn on alarm
// if not, turn off alarm
} // end loop
Step by Step Solution
There are 3 Steps involved in it
To write an Arduino program using direct register manipulation PORT PIN DDR well proceed with setting up the data direction registers reading the inpu... View full answer
Get step-by-step solutions from verified subject matter experts
