In: Electrical Engineering
. 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?
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