Question

In: Electrical Engineering

what is the following (ARDUINO): -The digitalRead function -The correct setup for the “for” / “for...

what is the following (ARDUINO):

-The digitalRead function

-The correct setup for the “for” / “for next loop” control:

- The analogWrite function can be used to

-Serial.print() will display information on

Solutions

Expert Solution

  • digitalRead(pin) reads the value from a specified digital pin (argument of the function) and returns either a HIGH or LOW. If the mentioned pin is not connected to anything the value returned by the function is not reliable - can be HIGH or LOW randomly.
  • For loop does not require any setup. The syntax for the function is as follows:

for(initialization; condition; increment)

{ // statements; }

'for next' loop is present as part of visual basic and not in Arduino.

  • analogWrite(pin, value) writes an analog value to the specified pin (which should be of integer data type). The parameter value specifies the duty cycle and can take integer values between 0 (always OFF) and 255 (always ON). It does not return any value and when it is called it generates a steady square wave of the specified duty cycle on the specified pin until other read/write functions on the same pin are called.
  • Serial.print(val, format) will give data (in the parameter val) to the serial port and thus, the device connected to the corresponding serial port will display the data. The second parameter of the function is optional and specifies the format of the data to be passed to the serial port.

Related Solutions

What would be the wiring setup and coding using an Arduino for a display of the...
What would be the wiring setup and coding using an Arduino for a display of the temperature of the room it is in?
what is the following (ARDUINO): -Examples of a standard Arduino library -The Arduino uses a structured...
what is the following (ARDUINO): -Examples of a standard Arduino library -The Arduino uses a structured programming language-what type -Channels of A/D conversion on the Arduino Uno -The Arduino correlates temperature readings with what
ARDUINO Create a function that will ask the user to enter the values for each of...
ARDUINO Create a function that will ask the user to enter the values for each of the three colors (red, green and blue) between 0 and 255. The function should check that the user does not enter a number bigger than 255 or smaller than 0. If this happens, the function should keep asking for a valid number.
Explain the section of code in the setup() function that implements the following instructions Wire.beginTransmission(0x68); Wire.write(0);             ...
Explain the section of code in the setup() function that implements the following instructions Wire.beginTransmission(0x68); Wire.write(0);              // set the address byte sec = Wire.read(); Wire.endTransmission();     // stop transmitting Wire.beginTransmission(0x68); Wire.write(0);              // set the address Wire.write(sec & 0x7F);     // clear CH bit Wire.endTransmission();     // stop transmitting Why is this necessary?
what is the following (ARDUINO): -Analog pins can be used to -AnalogReadSerial: -What pins on the...
what is the following (ARDUINO): -Analog pins can be used to -AnalogReadSerial: -What pins on the Arduino can be assigned as… -The Arduino uses what to assign analog values?
Pharaphrase and rewrite the following paragraph: Arduino Arduino Uno is a microcontroller board b... pharaphrase and...
Pharaphrase and rewrite the following paragraph: Arduino Arduino Uno is a microcontroller board b... pharaphrase and rewrite the following paragraph: Arduino Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to...
Design and program an Arduino-based circuit that contains the following items - 1 Arduino Uno microcontroller....
Design and program an Arduino-based circuit that contains the following items - 1 Arduino Uno microcontroller. - 1 IR remote control, - 1 IR sensor - 1 LCD 16x2 Display - Any other components you find necessary. The circuit will do the following: - The circuit represents a 2-digit calculator. - At start of operation, the LCD display should display “0” in line 2 of the LCD display. - Pressing the On/Off button on the IR remote represents the “Clear”...
What is the function of a centromere? Draw the correct order of the steps of mitosis,...
What is the function of a centromere? Draw the correct order of the steps of mitosis, label them, and state what occurs in each (this should not be a picture from the internet)? Why is apoptosis required to balance mitosis? What is binary fission? What are cell cycle check-points? What are the difference between proto-oncogenes and tumor suppressor genes? How to these impact the cell cycle? What are some life styles choices that can increase your risk of cancer? How...
witches »   HW-20: Arduino - Motor Speed.problem Arduino - Measuring Motor Speed Arduino sketch with...
witches »   HW-20: Arduino - Motor Speed.problem Arduino - Measuring Motor Speed Arduino sketch with corresponding line numbers per coding line. Match line # 1 through #17 with the corresponding instruction purpose. _____________________________________________________________________ 1.   int count = 0;      float f = 0;      float PPR = 500;      float RPM= 0; 2.   void setup() 3.      pinMode(2,INPUT); 4.      attachInterrupt(0,freq,RISING); 5.      Serial.begin(9600); 6.    void loop()       { 7.      count=0; 8.      delay(100); 9.      f=10*count; 10.    RPM=f/PPR; 11.    Serial.print(count); 12.    Serial.print(" Pulses/100ms");...
Multiple Choice/ Arduino Review -The Arduino uses what to assign analog values? a. Sine waves b....
Multiple Choice/ Arduino Review -The Arduino uses what to assign analog values? a. Sine waves b. PWM c. Square Waves d. Both b and c - Which Of the following is NOT an example Of a standard Arduino library? a. Servo b. TFT c. LiquidCrystal d. Thermo - The Arduino language is based on what? a. Python b. Java c. C/C++ d. HTML - How many channels of A/D conversion does the Arduino Uno have? a. 6 b. 13 c....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT