using circuits.io (website) to build circuits using arduino. i need help mostly
ID: 2082325 • Letter: U
Question
using circuits.io (website) to build circuits using arduino. i need help mostly with the code, i can build the circuit myself. thanks!! simple electronic circuits Rramming the Arduino UNo micro-controller to contro rams can give some hints for the 1.) Design a s bit down that uses the UNo to count from to 11111 binary LED up/ counter circuit per step) and then in 32 steps (with a of least o 25 seconds pause at counts back down to ooooo. use each of the five LED's (e.g. Red, Blue, Yellow, Green and orange) to represent the one's, fours, eight's, and s n's of the output word. You should also LED to the UNO that glows violet during the upward connect a Tricolor goes dark when the then glows pink during the down count and finally Tri last countdown must LED combinatio of the reaches ooooo. You determine what color diode will produce colors of violet and pink .0 2.) Design a analog to digital converter circuit using UNO that will read the 4 bit the analog voltage across a 10 kohm sliding or rotary potentiometer (refer to the uNO parts list on web page) and convert the variable Dc voltage across the pot into an equivalent 4 bit binary word. use four different colored LED's to represent the digits of the 4 bit binary word. Note that when the circuit is operating, any movement of the potentiometer wiper arm should result in a different output word being displayed, with the maximum value of 1111 corresponding to the maximum DC voltage of volts and 00000 corresponding to the minimum of 0 volts. Hint: If the potentiometer and 10 kohm constant value resistor are wired up as shown, then the maximum analog voltage across the pot will be about 4.5Vand the minimum voltage will be zero. The analog read command will return a number between 0 and 1024 corresponding to the value of pot voltage, then use the 4 bit pattern of diodes to show a binary number between 0(min volts )and 1111 (the maximum volts). If you divide the pot voltages into 16 discrete steps of 1024/16 64, then if loops can be used to light up the correct sequence of LEDs corresponding to each of the 16 possible voltage windows Note that the analogRead (POT) command should be used along with an analog output pin (denoted by Ao-A6 on the UNO chip Also note that the wiper arm should connected to the UNO output pin and the other ends of the pot to ground 10 and the kohm constant resistor, per schematic diagram in Figure 2Explanation / Answer
Solution - Question 1
Code
int r = 12, b = 11, y = 10, g = 9, o = 8; // control pins for the five LEDs
int red = 7, blue = 6, green = 5; // control pins for RGB CC (common Cathode) LED
// RGB values for violet = {128,0,255}
// RGB values for pink = {255,0,128}
int x;
void setup() {
pinMode(r, OUTPUT);
pinMode(b, OUTPUT);
pinMode(y, OUTPUT);
pinMode(g, OUTPUT);
pinMode(o, OUTPUT);
pinMode(red, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(green, OUTPUT);
}
void loop() {
x = 0;
// up - counter
while(x<32)
{
digitalWrite(r, HIGH && (x & B00000001));
digitalWrite(b, HIGH && (x & B00000010));
digitalWrite(y, HIGH && (x & B00000100));
digitalWrite(g, HIGH && (x & B00001000));
digitalWrite(o, HIGH && (x & B00010000));
analogWrite(red,128);
analogWrite(green,0);
analogWrite(blue,255);
delay(250);
x = x+1;
}
// down counter
while(x>0)
{
x = x-1;
if (x!=0)
{
analogWrite(red,255);
analogWrite(green,0);
analogWrite(blue,128);
}
else
{
analogWrite(red,0);
analogWrite(green,0);
analogWrite(blue,0);
}
digitalWrite(r, HIGH && (x & B00000001));
digitalWrite(b, HIGH && (x & B00000010));
digitalWrite(y, HIGH && (x & B00000100));
digitalWrite(g, HIGH && (x & B00001000));
digitalWrite(o, HIGH && (x & B00010000));
delay(250);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.