@@ -54,82 +54,26 @@ void setup()
5454 }
5555
5656 delay (200 );
57-
57+
5858 int32_t sensorStartError = radarSensor.presenceDetectorStart ();
59- Serial.println (" here" );
6059 if (sensorStartError != 0 )
6160 {
6261 Serial.println (" Sensor Started Successfully" );
6362 }
6463 else
6564 {
66- Serial.print ( " Error upon Setup: " );
67- Serial. println (sensorStartError);
65+ Serial.println ( " Sensor not initialized correctly - Freezing code. " );
66+ while ( 1 ); // Runs forever
6867 }
6968
70- // // Set Start to 1000mm
71- // if(radarSensor.setPresenceStart(1000) != 0)
72- // {
73- // Serial.println("Presence Start Error");
74- // }
75- // else
76- // {
77- // Serial.println("Presence Start Set: 1000");
78- // }
79-
80- // delay(500);
81-
82- // // Set end at 5000mm
83- // if(radarSensor.setPresenceEnd(5000) != 0)
84- // {
85- // Serial.println("Presence End Error");
86- // }
87- // else
88- // {
89- // Serial.println("Presence End Set: 5000");
90- // }
91-
92- // // Apply configuration
93- // if(radarSensor.setPresenceCommand(XM125_PRESENCE_APPLY_CONFIGURATION) != 0)
94- // {
95- // Serial.println("Presence Command Error");
96- // }
97- // else
98- // {
99- // Serial.println("Presence Configuration applied to device");
100- // }
101-
102- // // Wait for configuration to be done
103- // if(radarSensor.presenceBusyWait() != 0)
104- // {
105- // Serial.println("Device is busy");
106- // }
107-
108- // // Start detector -- mask 0x02 with Presence Reg command address
109- // if(radarSensor.startPresenceDetector() != 0)
110- // {
111- // Serial.println("Presence Detector Start Error");
112- // }
113- // else
114- // {
115- // Serial.println("Presence Detector Started!");
116- // }
117-
118- // // Wait for configuration to be done
119- // if(radarSensor.presenceBusyWait() != 0)
120- // {
121- // Serial.println("Device is busy");
122- // }
123-
124- Serial.println (" Presence Setup Complete" );
125-
69+ delay (1000 );
12670
12771}
12872
12973void loop ()
13074{
13175 // If Presence is detected, then print out distance from device
132- radarSensor.getPresenceDistanceResult (&presenceDetected);
76+ radarSensor.getPresenceDetectorPresenceDetected (&presenceDetected);
13377
13478 radarSensor.getPresenceDistance (&distance);
13579 Serial.print (" Presence detected at " );
@@ -144,8 +88,7 @@ void loop()
14488 Serial.println (" mm" );
14589 }
14690
147-
148-
91+ Serial.println (" loop" );
14992
150- delay (100 );
93+ delay (500 );
15194}
0 commit comments