Start ARDUINO SOFTWARE and Write a program that checks the voltage value in the circuit of three resistors. i. If the voltage is higher than 4V, turn ON red LED ii. If the voltage is higher than 2V and less than 3V, turn ON yellow LED iii. If the voltage is less than 2V turn ON green LED. Note that analog input is used in this example.
arduino code:-
int voltagecheckpin = A0; // use the analog pin A0 to check the
voltage
int RledPin = 2; // select the pin for the red LED
int GledPin = 3; // select the pin for the green LED
int YledPin = 4; // select the pin for the yellow LED
int voltagevalue = 0; // variable to store the value coming from
the voltage check pin
void setup()
{
// declare the ledPin as an OUTPUT:
pinMode(RledPin, OUTPUT);
pinMode(GledPin, OUTPUT);
pinMode(YledPin, OUTPUT);
}
void loop()
{
// read the value from the sensor:
voltagevalue = analogRead(voltagecheckpin);
if(voltagevalue>4)
{
digitalWrite(RledPin, HIGH);
digitalWrite(YledPin, LOW);
digitalWrite(GledPin, LOW);
}
else if(voltagevalue<3 && voltagevalue>2)
{
digitalWrite(RledPin, LOW);
digitalWrite(YledPin, HIGH);
digitalWrite(GledPin, LOW);
}
else if (voltagevalue< 2)
{
digitalWrite(RledPin, LOW);
digitalWrite(YledPin, LOW);
digitalWrite(GledPin, HIGH);
}
delay(500);
}
Start ARDUINO SOFTWARE and Write a program that checks the voltage value in the circuit of...
Microcontroller programming exercises by practice on Arduino: Write a program that lights a green LED attached to pin 3. The green LED should turn off after a button attached to pin4 has been pushed and released 3 times. Each time the button is pushed it will turn on a red LED attached to pin 7 and turn off a yellow LED attached to pin 9. When the button is not pushed the red LED will be off and the yellow...
Write an Arduino code to read the current temperature using the LM35 temperature sensor. The code should include the following if the temperature is more than 45 "C: • Turn ON red LED, and after 1 second turn ON the yellow LED, and after another 2 seconds tum On the Green LED. One second later the three LEDS should start blinking (all LEDs OFF for 0.5 seconds, then all LEDS ON for 1 minute), and turn OFF all LEDs after...
Problem 10 Use the following circuit to answer the next four questions. Recall that the resistor enclosed in a circle with two arrows is a photoresistor/photocell. The photoresistor will be used to control the circuit's behavior. If the room is dark, the red LED will illuminate. In moderate light, the yellow LED will illuminate. In bright light, the green LED will illuminate. The reading from the photoresistor at pin AO is assigned to the integer variable, "photo_value. ☆ ☆ Red...
6. LED Alarm Circuit One day, you come back to your dorm to find that your favorite candy has been stolen. Determined to catch the perpetrator red-handed, you decide to put the candy inside a kitchen drawer. Using the following circuit design, you would like to turn on a light-emitting diode (LED) "alarm" if the kitchen drawer is opened. Rli LED 2.5V LED Note Rphoto is a photoresistor, which acts like a typical resistor but changes resistance based on the...
Please answer the problem below for all parts. Please show all
work and write clearly. Thanks.
The circuit below is a temperature range indicator using a Window Comparator circuit. Discuss when you would use this type of analog circuit and when you would use a microcontroller based circuit like that of Lab 4 shown below. A window comparator usually employs 2 comparators with one output indicating the input is somewhere between two limits. In these examples, a third comparator is...
Write a complete Python program with prompts for the user for the main text file (checks that it exists, and if not, output an error message and stop), for any possible flags (including none), and for any other input that this program may need from the user: split has an option of naming the smaller files head_tail list the first 10 lines (default) and the last 10 lines (default) in order of the given text file flag: -# output #...
Write a Java program that generates an array of Fibonacci numbers. Specifications: The program -Fills a one-dimensional array with the first 30 Fibonacci numbers using a calculation to generate the numbers. Note: The first two Fibonacci numbers 0 and 1 should be generated explicitly as in -long[] series = new long[limit]; //create first 2 series elements series[0] = 0; series[1] = 1; -But, it is not permissible to fill the array explicitly with the Fibonacci series’ after the first two...
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 =...
Using C++
For a given electrical circuit, composed from a network ofresistors, arranged in parallel and/or series, write a program to calculate the total resistance of the circuit. To facilitate user to define the network, by giving the network circuit formula in text, a notation is used, whereand 7" operators mean series and parallel layout respectively. Please note that parallel 'operator has higher precedence than seriesoperator Table below shows a few examples of circuit diagrams and their respective circuit formulas...