Question

In: Electrical Engineering

Mr. Ndugu is using a HC-SR505 PIR motion sensor module in a lab project. Please suggest...

Mr. Ndugu is using a HC-SR505 PIR motion sensor module in a lab project. Please suggest Mr. Ndugu a proper way to connect this sensor to the Open1768 development board (i.e. to which pins, etc …) and to configure the selected pins! (4 points) Write a c code and let us assume that Mr. Ndugu wants to detect a rising edge of a signal generated by the sensor over the pin P2.7 (Pin 7 of Port2) (6points). later change the c code lines in such a way tat the LED0 &LED1 on the Open 1768 development board are switched ON while LED1 and LED2 are switched OFF if a rising edge is detected on pin P2.7(5points)

Solutions

Expert Solution

a)This is the code to detect a rising edge of a signal generated by the sensor over the Pin2.7

#define pirPin 2
#define ledPin 13

// Create variables:
int val = 0;
bool motionState = false; // We start with no motion detected.

void setup() {
  // Configure the pins as input or output:
  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);

  // Begin serial communication at a baud rate of 9600:
  Serial.begin(9600);
}

void loop() {
  // Read out the pirPin and store as val:
  val = digitalRead(pirPin);

  // If motion is detected (pirPin = HIGH), do the following:
  if (val == HIGH) {
    digitalWrite(ledPin, HIGH); // Turn on the on-board LED.

    // Change the motion state to true (motion detected):
    if (motionState == false) {
      Serial.println("Motion detected!");
      motionState = true;
    }
  }

  // If no motion is detected (pirPin = LOW), do the following:
  else {
    digitalWrite(ledPin, LOW); // Turn off the on-board LED.

    // Change the motion state to false (no motion):
    if (motionState == true) {
      Serial.println("Motion ended!");
      motionState = false;
    }
  }
}

Related Solutions

Mrs. Halima has bought an ultrasonic ranging sensor module HC-SR04. P1.1) If the manufacturer claims this...
Mrs. Halima has bought an ultrasonic ranging sensor module HC-SR04. P1.1) If the manufacturer claims this sensor to be IP66 compatible. Please explain the properties of the sensor Mrs Halima must check in this context! (4 points)
please draw a sequence diagram Basic package: 6 window sensor, 3 door sensor, 1 motion sensor,...
please draw a sequence diagram Basic package: 6 window sensor, 3 door sensor, 1 motion sensor, 1 glass sensor Basic Plus: 10 window sensor, 4 doors sensor, 2 motion sensor, 2 glass sensor Elite: 15- window sensor, 6 doors sensor, 3 glass sensor All packages will also include an alarm system devices of a give package are with the alarm system. Customers have the option to disable a device. Customers can also armed or disarm the system. Customers would need...
This module covers different approaches to project selection (such as payback analysis or using a weighted...
This module covers different approaches to project selection (such as payback analysis or using a weighted scoring model). Analyze at least five different ways of project selection. Present the advantages and disadvantages of each method. Explain how you used a selection approach to choose your term project.
Please suggest a Course Project Outline, Work Plan, and Preliminary Bibliography for my capstone project which...
Please suggest a Course Project Outline, Work Plan, and Preliminary Bibliography for my capstone project which Topic is: What constitutes effective leadership in a changing business environment?
using lunix or C programming to answer this lab please fill in the blanks with the...
using lunix or C programming to answer this lab please fill in the blanks with the answere being highlighted, so i can understand. First, type the following command:             sort employee What is the order that employee is sorted in? ___________________________________________ Give a brief description of how the file is sorted. _____________________________________________________________________________________________________________________________________________________________________________________________________ Now, sort on the field for last name.         sort +1 employee Look at the sorted file. Are all the names sorted in alphabetical order? ______________________ Give a brief description...
In this Lab you will be using Microsoft Excel to calculate some significance tests. Please read...
In this Lab you will be using Microsoft Excel to calculate some significance tests. Please read Chapters 11 and 12 of "Applied Statistics for Business Management using Microsoft Excel." Complete practice problem #1 in Chapter 11 and practice problem #2 in Chapter 12. The practice problems are located towards the end of each Chapter. You must use Microsoft Excel to complete your lab and turn in your assignment. Design1 Design2 Design3 Design4 206.67 217.43 227.12 230.90 208.29 221.78 225.14 228.30...
Consider the system x'= -y , y' = -x Sketch the vector field using math-lab. Please...
Consider the system x'= -y , y' = -x Sketch the vector field using math-lab. Please write the code with all the steps. I'm new on math-lab, and I tried to follow some online videos but it did not work right. I have the sketch, but I need the code and the steps to learn it. Thank you,
please fill ot the data sheet for  conservation of angular momentum using two air mounted disks lab....
please fill ot the data sheet for  conservation of angular momentum using two air mounted disks lab. (show all work) Table 1. Moment of Inertia of the disks Mass, M (kg) Diameter (m) Radius (m) I (kg.m2 ) Upper disk 1.3563 0.125 .0625 I upper = .0026490 Lower disk 1.3438 0.125 .0625 I upper = .0026246 Table 2. Inelastic collision of two disks                                           Trial Reading of counter, n Angular velocity, w (rad/s) Angular momentum, L (kg.m 2/s) %diff. Before collision after...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and use a function named highest() that takes three inputs and returns the highest number. After you have got it working, try calling the function with inputs ‘hat’, ‘cat’, ‘rat’.
(C++. Please don't use #include <bits/stdc++.h>) This lab exercises your understanding of using a Heap to...
(C++. Please don't use #include <bits/stdc++.h>) This lab exercises your understanding of using a Heap to create a Priority Queue Follow these steps: Declare an integer array to use for the heap (size of 20 to 30 elements) Create an insertion function (and any needed helper functions) that creates a min-heap (smallest priority is most important) Create a remove function (and any needed helper functions) that removes the min value from the heap and returns it In main, call the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT