Question

In: Electrical Engineering

. What does each line of the following code do? fsrPin = ‘A4’; ledPin = ‘D4’;...

. What does each line of the following code do?

fsrPin = ‘A4’; ledPin = ‘D4’;

anArduinoObj = arduino();

forceVoltage = readVoltage(anArduinoObj, fsrPin);

if forceVoltage > 4.0

writeDigitalPin(anArduinoObj, ledPin, 1);

end

Based on the Adafruit pages related to their round FSR sensor, what is the required force to read a voltage greater than 4V?

Solutions

Expert Solution

fsrPin = ‘A4’; ledPin = ‘D4’;                // Sets variables fsrPin and ledPin to A4 and D4 respectively

anArduinoObj = arduino();                // Recreates the last successful connection to the Arduino. If that connection

                                                              // fails, it creates a connection to the first official Arduino hardware

                                                              // connected to your host computer via USB.

                                                              // Establishes connection to the anArduinoObj object created

forceVoltage = readVoltage(anArduinoObj, fsrPin);          // Reads the voltage(analog) on fsrPin into forceVoltage variable

if forceVoltage > 4.0

writeDigitalPin(anArduinoObj, ledPin, 1);                // If forceVoltage measured is more than 4 then ledPin is made high. Most probably lighitng an LED.

end


Related Solutions

What does each line of this python code do? import datetime import getpass print("\n\nFinished execution at...
What does each line of this python code do? import datetime import getpass print("\n\nFinished execution at ", datetime.datetime.now()) print(getpass.getuser())
explain the code for a beginner in c what each line do Question 3. In the...
explain the code for a beginner in c what each line do Question 3. In the following code, answer these questions: Analyze the code and how it works? How can we know if this code has been overwritten? Justify how? #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { int changed = 0; char buff[8]; while (changed == 0){ gets(buff); if (changed !=0){ break;} else{     printf("Enter again: ");     continue; } }      printf("the 'changed' variable...
I'm having trouble understanding the following code (a snippet of a code). What does it do?...
I'm having trouble understanding the following code (a snippet of a code). What does it do? The whole code is about comparing efficiencies of different algorithms. def partition(list,first,last): piv = list[first] lmark = first+1 rmark = last done = False while not done: while lmark <= rmark and list[lmark]<=piv: lmark=lmark+1 while list[rmark]>=piv and rmark>=lmark: rmark=rmark-1 if rmark<lmark: done = True else: temp = list[lmark] list[lmark]=list[rmark] list[rmark]=temp temp = list[first] list[first]=list[rmark] list[rmark]=temp return rmark
What does each line in the code?? Please unsigned Long timer1; unsigned Long button_dbnc_tmr = 0;...
What does each line in the code?? Please unsigned Long timer1; unsigned Long button_dbnc_tmr = 0; const int User_Button = 2; const int USER_LED_Pin = 13; bool allow_change = 0; int counter = 0; int state; void read_state_from_memory(void); void write_state_to_memory(void); void turnoff(void); void flash_1s(void); void flash_2s(void); void flash_3s(void); void setup() { read_state_from_memory(); pinMode(USER_LED_Pin, OUTPUT); Serial.begin(9600); } void loop() { timers(); if(digitalRead(User_Button) == 1) { if(allow_change == 1) { state++; Serial.println(counter); Serial.println(state); allow_change = 0; if(state > 3) state = 0;...
Explain the following code. What language? What does it do? What is the result?                 <!DOCTYPE...
Explain the following code. What language? What does it do? What is the result?                 <!DOCTYPE teo[                                 <ELEMENT teo((stations| databases)+)>                                 <ELEMENT stations(stationName stationLocation sensors*)> <ELEMENT databases(databaseName databaseType )> <ELEMENT stationName(#PCDATA)> <ELEMENT stationLocation(#PCDATA)> <ELEMENT sensors (sensorName phenomenon)+> <ELEMENT sensorName(#PCDATA)> <ELEMENT phenomenon(#PCDATA)> <ELEMENT databaseName(#PCDATA)> <ELEMENT databaseType(#PCDATA)> <!ATTLIST stations boundingBox CDATA #required> ]>
4. Explain what is happening on each line of the following AVR assembly code. If you...
4. Explain what is happening on each line of the following AVR assembly code. If you were to execute this code what would be the final decimal values in R20, R21 and SREG registers? BCLR 0 BCLR 1 BCLR 2 BCLR 3 BCLR 4 BCLR 5 BCLR 6 BCLR 7 LDI ​R19, 0x02 LDI​R20, 0x74 LDI​R21, 0x04 LDI​R22, 0x22 ADD​R20, R22 SUB​R22, R21 ADD​R20, R21 MOV​R20, R21 JMP​DONE ADD​R21, R20 SUB​R21, R22 DONE:​SUB​R20, R21 -embedded system-
For each of the following write the line(s) of code that: Declares and initializes (creates) an...
For each of the following write the line(s) of code that: Declares and initializes (creates) an ArrayList that holds String objects Adds to your ArrayList the words "Too" and "Fun" Verifies that your ArrayList now contains 2 elements Sets the second String in the ArrayList to "No" Verifies that your ArrayList still contains exactly 2 elements Prints the contents of the ArrayList to the screen in the following format: <element>, <element>, . . . , <element>
a. What will be the output of LINE A in code “a” and output of code...
a. What will be the output of LINE A in code “a” and output of code “b”? Also write reasons for the outputs. a. #include <sys/types.h> #include <stdio.h> #include <unistd.h> int value = 3; int main() { pid_t pid; pid = fork(); if (pid = = 0) {/* child process */} value += 233; return 0; } else if (pid > 0) {/* parent process */} wait(NULL); printf(“PARENT: value = %d”, value); /* LINE A */ return 0; } }...
What is the output of the code below? After each line that has a cout, write...
What is the output of the code below? After each line that has a cout, write what the output of the code is. See example in code below. int i = 2, j = 1, k = i + j; cout << k << endl; ➔ 3 double d = 2.99, e = 1, f = d + e; cout << f << endl; double q = 1.50; cout << q/3 << endl; cout << 6.0/4 << endl; char c...
Describe what each line does in the following SQL query The lyrics database is provided under...
Describe what each line does in the following SQL query The lyrics database is provided under question 3 for context 1. select studioID, studioname, base from salespeople sa inner join studios st on (sa.salesID = st.salesid) where base < 300 2. select concat_ws(' ', firstname, lastname) as "Member Name"         from members; 3. select m.lastname, m.firstname, s.lastname         from members m inner join salespeople s using (salesID)         order by m.lastname asc; The lyrics database is provided below DROP TABLES...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT