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 84fec86

Browse files
+ examples/MicromlMorseIdentificationExample
1 parent 38043ec commit 84fec86

File tree

4 files changed

+74
-10
lines changed

4 files changed

+74
-10
lines changed

‎.idea/workspace.xml‎

Lines changed: 14 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#define IN 4
2+
#define NUM_SAMPLES 30
3+
#define INTERVAL 100
4+
5+
6+
double features[NUM_SAMPLES];
7+
8+
9+
void recordButtonStatus() {
10+
for (int i = 0; i < NUM_SAMPLES; i++) {
11+
features[i] = digitalRead(IN);
12+
delay(INTERVAL);
13+
}
14+
}
15+
16+
#include "record.h"
17+
//#include "classify.h"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "model.h"
2+
3+
void setup() {
4+
Serial.begin(115200);
5+
pinMode(IN, INPUT_PULLUP);
6+
}
7+
8+
void loop() {
9+
if (digitalRead(IN) == 0) {
10+
recordButtonStatus();
11+
Serial.print("Detected letter: ");
12+
Serial.println(classIdxToName(predict(features)));
13+
delay(1000);
14+
}
15+
16+
delay(10);
17+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
void printFeatures();
2+
3+
4+
void setup() {
5+
Serial.begin(115200);
6+
pinMode(IN, INPUT_PULLUP);
7+
}
8+
9+
void loop() {
10+
if (digitalRead(IN) == 0) {
11+
recordButtonStatus();
12+
printFeatures();
13+
delay(1000);
14+
}
15+
16+
delay(10);
17+
}
18+
19+
void printFeatures() {
20+
const uint16_t numFeatures = sizeof(features) / sizeof(double);
21+
22+
for (int i = 0; i < numFeatures; i++) {
23+
Serial.print(features[i]);
24+
Serial.print(i == numFeatures - 1 ? '\n' : ',');
25+
}
26+
}

0 commit comments

Comments
(0)

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