Lab 1 Flashcards
How many different types on inputs/outputs does an Arduino Uno have?
3, digital, analog, serial
Digital Output
A digital output is a signal that can take two states: a high voltage state (typically 5 V or 3.3 V on the Arduino Uno) and a low-voltage state (0V) . This can be used to control relays and other switch devices as well as other low power devices, such as LEDs.
Analog input
An analog input reads continuous voltage levels between 0 V and 5 V. This is then represented as a 10 bit input signal with a value between zero and 1023 ( zero, one,…, 1023 represents values from 0 V to 5 V with increments of 5/1023 V). this is ideal for reading voltages across a sensor such as light dependent resistors
Serial input
A serial input allows the air to communicate with other devices, such as a computer. This can be useful for debugging and displaying data data. In our application, we will use this to form and understanding of what is happening by printing statements and data like sensor values from the Arduino.
Light dependent resistor (LDR)
A resistor is an electrical circuit component that limits the current, passing through a wire, analogist to a restriction in a water pipe. An LDR is a variable resistor whose value resistance increases/decreases, depending on the intensity of the light shining on its surface. They Arduino measures the voltage across the LDR, which is related to the resistance of the LDR (which is related to the light intensity) according to the following equation:
V(ldr)= R(ldr)/(R+R(ldr))V(cc)
Light emitting diode LED
An LED is a component that lights up when current passes through it. LEDs range widely and bright, power rating, and color and subsequently used in various applications, ranging from room lights to largest scale displays. And LED brightness can be controlled by changing its voltage or current. And they are, we know this can be realized using pulse with modulation, PWM
Pulse with modulation PWM
PWM is a technique used to simulate varying voltage levels. This is done by changing the value of an output pin from 0 V to 55 V over a given duration of time so that the average voltage over that duration is the desired value we want to achieve.
Pin
Is any digital or analog pin number labeled on the board?
Mode
Can be either input or output
pinMode(pin,mode)
This is used to set up a pin as either input, output, or input_pullup
Serial.begin(baudRate)
It is used to initialize serial communication between the computer and the are doing up. BaudRate can take values from 9600, 14,400, 19,200, etc.
The Baudrate is the right at which this communication takes place in bits per second. It can be 9600 bits per second for lower speed Arduino projects. But we can change it to 14,400 bits per second and even up to 57,600 bits per second if we need to increase the rate to add which we read and process data. The downside of using a higher rate is that this will use more energy and resources, which the processor could otherwise use to run more complex computations.
AnalogRead(pin)
Dysfunction reads an input from an analog input pin. The read value is a 10 bit binary number. It is a value that ranges from 0 to 1023. Then returns the value read.
Pin is one of the analog input pins.
Serial.print(data)
Dysfunction is used to send data to the serial port to visualize the given data on the computer. Data can be filled with variables, strengths, and many other data types. This is not like the ‘cout’ statement. Strings are in quotation marks, while variables and numbers are not. This function uses spaces and commas as the limit, which indicate the end of one data to be plotted, and the start of a new one. A good style is to print a string to be used as a legend in the plot, followed by the value to be printed, followed by, such as.
Serial.print(“input_value:”);
Serial.print(variable_name);
Serial.print(“,”);
Serial.println(data)
Is the same as serial.print but adds a new line at the end of the data. Data can be filled with variables, strings, and many other data types.
analogWrite(pin,data)
Dysfunction is used to send a PWM signal to a pin. Pin is any PWM capable digital pin on the Arduino. Data is an integer between zero and 255.
Delay(duration)
This function pauses the program for the amount of time specified. Duration is an integral value representing the number of milliseconds delay the program.