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 f7416ad

Browse files
fix examples/MicromlIrisExample
1 parent 4bc45fa commit f7416ad

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

‎.idea/workspace.xml‎

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
#include "iris.h"
22

3+
double features[4];
34

45
void setup() {
56
Serial.begin(115200);
67
}
78

8-
99
void loop() {
1010
if (Serial.available()) {
11-
double features[4];
12-
1311
for (int i = 0; i < 4; i++) {
1412
String feature = Serial.readStringUntil(',');
1513

1614
features[i] = atof(feature.c_str());
1715
}
1816

17+
printFeatures();
1918
Serial.print("Detected species: ");
2019
Serial.println(classIdxToName(predict(features)));
2120
}
2221

2322
delay(10);
23+
}
24+
25+
void printFeatures() {
26+
const uint16_t numFeatures = sizeof(features) / sizeof(double);
27+
28+
Serial.print("You entered: ");
29+
30+
for (int i = 0; i < numFeatures; i++) {
31+
Serial.print(features[i]);
32+
Serial.print(i == numFeatures - 1 ? '\n' : ',');
33+
}
2434
}

0 commit comments

Comments
(0)

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