Skip to content

Commit 4e05b81

Browse files
Functional examples and class functions
Working through isolating the presence detection - all work is now correct and can run the presence code successfully
1 parent a40fde0 commit 4e05b81

File tree

7 files changed

+273
-217
lines changed

7 files changed

+273
-217
lines changed

Examples/Example1_BasicReadings/Example1_BasicReadings.ino

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ void setup()
2929

3030
void loop()
3131
{
32-
33-
bool dataReady = mySensor.getDataReady();
32+
bool dataReady = mySensor.getDataReady();
3433

35-
if(dataReady == true)
34+
if(dataReady == 1)
3635
{
37-
sths34pf80_tmos_func_status_t status = mySensor.getStatus();
36+
sths34pf80_tmos_func_status_t status;
37+
mySensor.getStatus(&status);
3838

3939
// If the flag is high, then read out the information
4040
if(status.pres_flag == 1)
@@ -48,11 +48,7 @@ void loop()
4848
if(status.mot_flag == 1)
4949
{
5050
Serial.println("Motion Detected!");
51-
mySensor.getMotionValue(&motionVal);
52-
Serial.print("Motion: ");
53-
Serial.println(motionVal);
5451
}
5552
}
5653

57-
}
58-
54+
}

examples/Example2_Interrupts/Example2_Interrupts.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ void loop()
6767
}
6868
}
6969

70-
}
70+
}

examples/Example3_EmbeddedFunctions/Example3_EmbeddedFunctions.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ void setup()
4343
// Set hysteresis for the motion sensing
4444
mySensor.setMotionHysteresis(hysteresis);
4545

46-
4746
// Disable access to embedded functions registers
4847
mySensor.setMemoryBank(bankDisable);
4948
// Enter continuous mode
@@ -75,4 +74,4 @@ void loop()
7574
Serial.println(motionVal);
7675
}
7776
}
78-
}
77+
}

examples/Example4_SPIFunctionality/Example4_SPIFunctionality.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ void loop()
5858
Serial.println(motionVal);
5959
}
6060
}
61-
}
61+
}

examples/Example5_ArduinoPlotterOutput/Example5_ArduinoPlotterOutput.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <Wire.h>
33

44
STHS34PF80_I2C mySensor;
5-
// STHS34PF80_SPI mySensor;
65

76
// Global Presence Value
87
int16_t presenceVal = 0;
@@ -35,9 +34,10 @@ void loop()
3534

3635
bool dataReady = mySensor.getDataReady();
3736

38-
if(dataReady == true)
37+
if(dataReady == 1)
3938
{
40-
sths34pf80_tmos_func_status_t status = mySensor.getStatus();
39+
sths34pf80_tmos_func_status_t status;
40+
mySensor.getStatus(&status);
4141

4242
// If the flag is high, then read out the information
4343
if(status.pres_flag == 1)
@@ -47,4 +47,4 @@ void loop()
4747
}
4848
}
4949

50-
}
50+
}

0 commit comments

Comments
 (0)