int LEDG=8;
int LEDR=9;
int LEDY=10;
int LEDB=11;
void setup() {
Serial.begin(9600);
pinMode(LEDG, OUTPUT);
pinMode(LEDR, OUTPUT);
pinMode(LEDY, OUTPUT);
pinMode(LEDB, OUTPUT);
}
void loop() {
// read the input on analog pin 0 from sensor:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a
voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
if (voltage ==0) //Green light on
{
digitalWrite(LEDR,LOW);
digitalWrite(LEDB,LOW);
digitalWrite(LEDY,LOW);
digitalWrite(LEDG,HIGH);
delay(1000);
}
else if(voltage==5) //blue & red flashing
{
digitalWrite(LEDY,LOW);
digitalWrite(LEDG,LOW);
digitalWrite(LEDR,HIGH);
digitalWrite(LEDB,LOW);
delay(1000);
digitalWrite(LEDB,HIGH);
digitalWrite(LEDR,LOW);
delay(1000);
}
else //yellow flashing
{
digitalWrite(LEDR,LOW);
digitalWrite(LEDB,LOW);
digitalWrite(LEDG,LOW);
digitalWrite(LEDY,HIGH);
delay(1000);
digitalWrite(LEDY,LOW);
delay(1000);
}
}
Simulate a Sensor to control an alarm Before you attempt this assignment, it is suggested you...
Assignment 2: Simulate a Sensor to control an alarm Before you attempt this assignment, it is suggested you understand circuits (and the Arduino code) 1B and 1C. Sensor That being said, in this assignment, we’ll be mimicking an Infrared Sensor (detects objects) by utilizing the potentiometer. The potentiometer will provide us voltage potential that we can vary from 0V to 5V (similar to 1B). This voltage potential represents the output of a sensor. Assume the sensor cannot detect anything beyond...
MICROCONTROLLERS (Arduino Uno) Submit a schematic drawing and source code: Operating a simple DC motor with a Potentiometer Minimum 3 speeds; fast, slow, stop (0/mph) At fast, green LED on At slow, yellow LED on At stop, red & blue LEDs alternating on/off Thank you in advance
EECP3171 - Assignment Sem-3 (2018-19) Submission method: Individual Demonstration of Simulation on Tinkercad Demonstration Schedule: 20 June - Thursday 9:00 till 1:00 PM in CE111 (my office) Note: Any student who will come after deadline will be marked zero. Problem Statement Develop a simulation of a Electronic Thermometer using Tinkercad. The LCD will display the temperature in Celsius and Fahrenheit. Red LED will be ON if temperature is> 50 C and Green will be ON if temperature is < 50...