Question

Problem 10 Use the following circuit to answer the next four questions. Recall that the resistor enclosed in a circle with tw

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1-->

2 LEDS could illuminate because let us consider photovalue to be 200, in that case only green LED will blink

If photovalue is 50, then red and green will get illuminated

So only 2 LEDS can be illuminated.

2-->

Before setting all the pins low

This happens so because everytime the loop is run, we encounter either of the conditional statements, and so we will surely get a delay. So putting delay after reading the photovalue or before setting the pins to low will make our program work. But the problem with setting the delay after reading the photovalue is that it will wait for 1 second and the required LED will illuminate for infinite time. So what we want is to first illuminate the LED, wait for 1 second and then switch it off.
So the idea is to put the delay before switching of all the pins.

3-->

No LED will illuminate

When we read value 80, first if will not get executed because 75 is not greater than 80 and so we get into the else if condition, which says that 80 is not greater than 150, hence it will also not execute

So no LED will illuminate

4-->

int holdPhotoValue(int photo_value){

delay(500);

int new_reading = analogRead(A0);

int difference = abs(photo_value - new_reading);

if(difference<10){

return photo_value;

}

else

{

return new_reading;

}

}

I hope you liked the answer, please do give an upvote, Thanks

}

Add a comment
Know the answer?
Add Answer to:
Problem 10 Use the following circuit to answer the next four questions. Recall that the resistor...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I am doing an Arduino Uno project where I made a "Simon says" memory game with 3 neopixel LED str...

    I am doing an Arduino Uno project where I made a "Simon says" memory game with 3 neopixel LED strips and 3 - ultrasonics. I have them working independently but I need to combine the code so they work together. Here is what I have: Memory Game #define PLAYER_WAIT_TIME 2000 // The time allowed between button presses - 2s byte sequence[100]; // Storage for the light sequence byte curLen = 0; // Current length of the sequence byte inputCount =...

  • I have a program for Arduino written such that when I hold a button down, it...

    I have a program for Arduino written such that when I hold a button down, it will turn an LED off. I want to be able to print to the serial monitor how long the button was pressed for after I let go of the button. Does anybody have any ideas? Below is the code I have written thus far: Text of Code: #define LED RED_LED #define buttonPIN PUSH2 const int buttonPin = PUSH2; // the number of the pushbutton...

  • Having trouble with an automatic traffic light program. Red LED and Yellow LED won't show. We...

    Having trouble with an automatic traffic light program. Red LED and Yellow LED won't show. We are using a Dragon12 Plus 2 board, Code is below     #include C:\Users\schwarzenbar\Desktop\hcs12.inc       RED: EQU $10 ;PP4     GREEN:   EQU $40 ;PP6    org $2000    movb   #$FF, DDRP    bset   PTP, #RED     bset    DDRT,%00110000   ;PT4=Output for for IR Transmiter (IRTX)     bclr    DDRT,%00001000   ;PT3=Input pin for IR receiver (IRRX)     bclr    PTT,%00001000   ;PT4=0 to turn on IR...

  • This question is about the Arduino code. Please complete a 4-input circuit on your Arduino. Your...

    This question is about the Arduino code. Please complete a 4-input circuit on your Arduino. Your circuit, in addition to cycling through a binary representation of the numbers 0-15 using LEDs, should use the Serial port to output the decimal equivalent of each of the numbers in the format: Output: 15 ... if the value was 1111, and so forth. You will be asked to upload your code as well as a photo of your working breadboard circuit. Add comments...

  • I need help with doing these tasks for code composer Lab 3 - Branching, Push Button...

    I need help with doing these tasks for code composer Lab 3 - Branching, Push Button and LEDs-Reading Assignment in this lab, we are going to control a LED via a push button- using general purpose digital 10 for both input (button) and output (LED) on port 1 - using Code Composer Studio. Furthermore, we are going to use a branch instruction to create an IF-ELSE structure in assembly to determine if the LED should be lit up based on...

  • i posted device what i use Introduction Project 1 is designed to increase famiarty with Amel Studia, the Atmel So...

    i posted device what i use Introduction Project 1 is designed to increase famiarty with Amel Studia, the Atmel Software Framework, and te N ELVIS Il electrical test and measurement บnten. In addeen, it as LEDs vd pushbumons (overs concepts such as de-bouncing pushb.nors, ล"d sina ig and sorong with a microcontroler Materials 1 SAMD21 or SAMN25 Xpuined Pro Evaluation Board 2 LED 3300 resistor 4) 10k resistor S Push buttorn hamper wees Breadboar 8 SAMD21 Datasheet Equipment NI ELVIS...

  • Can someone please show me a circuit diagram so i can see how to construct this...

    Can someone please show me a circuit diagram so i can see how to construct this on a bread board i am id 6 yhanks in advance EEET-2251: Course & Projoct Guide 2018 EEET-2251: Cousc &Projoct Guide 2018 affic Light Controller A single switch must set your HC74 based state machine to the initial state (the U state This lab will get you to design a simple controller for a pedestrian crossing based on synchronous digital logic. You will master...

  • Design a circuit and Arduino program that accomplishes the following: An IR distance sensor will detect the presence (t...

    Design a circuit and Arduino program that accomplishes the following: An IR distance sensor will detect the presence (through waving of a hand) A H-Bridge circuit with 9V battery power will control the direction of the DC motor as described in Chapter 4 (pp. 70-79) of your textbook. When a hand is waved over the IR sensor, the motor moves in one direction (simulating opening a door). There is a 2 second pause, and then the motor moves in the...

  • Pease answer questions 4 and 5! Thank you so much! 4. Connect the 2nd resistor in...

    Pease answer questions 4 and 5! Thank you so much! 4. Connect the 2nd resistor in parallel with the 1st resistor and connect that combination to the battery.          Measure the following:               The current passing through the R1, I1 = ___0.0058____ A               The current passing through the R2, I2 = ___0.0031____ A               The current supplied by the battery, I = ___0.0092____ A              Calculate I1 + I2 = ____________ A                     Is the following statement true? I = I1 +...

  • import javax.swing.*; import java.awt.*; import java.util.List; import java.util.*; /** * Canvas is a class to allow...

    import javax.swing.*; import java.awt.*; import java.util.List; import java.util.*; /** * Canvas is a class to allow for simple graphical drawing on a canvas. * This is a modification of the general purpose Canvas, specially made for * the BlueJ "shapes" example. * * @author: Bruce Quig * @author: Michael Kolling (mik) * Minor changes to canvas dimensions by William Smith 6/4/2012 * * @version: 1.6 (shapes) */ public class Canvas { // Note: The implementation of this class (specifically the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT