Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 03783de

Browse files
authored
Merge pull request #2416 from arduino/taddy/portenta-x8-edge-ai-appnote-update
Portenta X8: Edge AI for Flow Analysis Application Note Resource Update
2 parents 9b86895 + 75a9908 commit 03783de

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

‎content/hardware/04.pro/boards/portenta-x8/tutorials/15.edge-ai-docker-container/content.md‎

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -535,50 +535,50 @@ The M4 core needs to have the **`rpc-flow-sensor.ino`** uploaded to collect and
535535
FlowSensor flowSensor(SENSOR_TYPE, SENSOR_PIN);
536536
537537
void count() {
538-
flowSensor.count();
538+
flowSensor.count();
539539
}
540540
541541
// Function to get Flow Rate (for RPC)
542542
float getFlowRate() {
543-
flowSensor.read();
544-
float flowRate = flowSensor.getFlowRate_m(); // Get flow rate in L/min
543+
flowSensor.read();
544+
float flowRate = flowSensor.getFlowRate_m(); // Get flow rate in L/min
545545
546-
if (isnan(flowRate) || isinf(flowRate)) {
547-
return 0.0; // Default to 0 if no valid reading
548-
}
549-
return flowRate;
546+
if (isnan(flowRate) || isinf(flowRate)) {
547+
return 0.0; // Default to 0 if no valid reading
548+
}
549+
return flowRate;
550550
}
551551
552552
void setup() {
553-
SerialDebug.begin(115200);
554-
//while (!SerialDebug);
553+
SerialDebug.begin(115200);
554+
//while (!SerialDebug);
555555
556-
SerialDebug.println("Starting Flow Sensor ");
556+
SerialDebug.println("Starting Flow Sensor ");
557557
558-
flowSensor.begin(count); // Initialize the Flow Sensor
558+
flowSensor.begin(count); // Initialize the Flow Sensor
559559
560-
// RPC Binding: Function to get flow rate
561-
RPC.bind("flow_rate", [] {
562-
return 11;
563-
});
560+
// RPC Binding: Function to get flow rate
561+
RPC.bind("flow_rate", [] {
562+
return getFlowRate();
563+
});
564564
565-
// RPC Binding: Receive classification results
566-
RPC.bind("classification", [](std::string const& input) {
567-
SerialDebug.print("Classification Received: ");
568-
SerialDebug.println(input.c_str());
569-
return 1;
570-
});
565+
// RPC Binding: Receive classification results
566+
RPC.bind("classification", [](std::string const& input) {
567+
SerialDebug.print("Classification Received: ");
568+
SerialDebug.println(input.c_str());
569+
return 1;
570+
});
571571
572-
SerialDebug.println("Setup complete.");
572+
SerialDebug.println("Setup complete.");
573573
}
574574
575575
void loop() {
576-
float flowRate = getFlowRate();
577-
SerialDebug.print("Flow Rate: ");
578-
SerialDebug.print(flowRate);
579-
SerialDebug.println(" L/min");
576+
float flowRate = getFlowRate();
577+
SerialDebug.print("Flow Rate: ");
578+
SerialDebug.print(flowRate);
579+
SerialDebug.println(" L/min");
580580
581-
delay(1000);
581+
delay(1000);
582582
}
583583
```
584584

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /