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

1 Expert Approved Answer
Step: 1 Unlock

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

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!