The lab exercise revolved around how to read sensor readings input for digital and analog sensors.
A binary/digital sensor reading will have falling and rising edges (state change).
An analog sensor will have falling and rising edges, and peak.
Keywords to remember: state change detection, threshold crossing, and peak detection.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
DIGITAL SENSORS STATE CHANGE DETECTION
The parts for the digital exercise included using an Arduino NANO 33 IOT, a breadboard, push button, 10K ohm resistor, and jumper wires.

Questions I have in this part of the exercise:
1) Why are we even comparing previous and current button states? I am still confused as to the purpose of this. Is it for future use when we need to activate a certain output without having to keep pressing the pushbutton so as to utilize it by only pushing it once on/off?
2) What is initializing serial communication 'serial.begin()'?
Learnt point:
1) Did not know where the serial.println () could be found until I looked it up, and found that I have to go to Tools -> Serial Monitor, for it to appear.

----------------------------------------------------------------------------------------------------------------------------------------------------------------
ANALOG SENSOR THRESHOLD DETECTION
Note to self: an analog sensor on an Arduino can have up to 1024 possible states.
The parts for the analog exercise included using an Arduino NANO 33 IOT, a breadboard, force sensing resistor (FSR), 10K ohm resistor, and jumper wires.

A question I have for this part of the exercise:
1) Why do we not setup pinMode for the analog pin?


More questions for this part of the exercise:
1) Why can't I program if-condition statement in a way where I can check if the sensor state/value is less than that of the last senser state, and check if peak value is greater than threshold instead of checking if the sensor state/value dropped below the threshold? What if the peak value is above the threshold?
2) How do we determine the noise of a sensor?
3) Not sure I completely understand the if-condition statement below in terms of adding and subtracting noise:
if (sensorValue <= threshold - noise ) {
if (peakValue > threshold + noise){
if (peakValue > threshold + noise){
//instructions
}
}
Is it that we account for the lower range when we compare with a value that should be lower, and a higher range when we compare with a value that should be higher?