File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ func main() {
28
28
var network n2.NeuralNetwork
29
29
var epoch uint16 = 0
30
30
31
+ led := machine .PC13
32
+ led .Configure (machine.PinConfig {Mode : machine .PinOutput })
33
+ led .High ()
34
+
31
35
machine .UART1 .SetBaudRate (31250 )
32
36
for {
33
37
command , error := machine .Serial .ReadByte ()
@@ -45,18 +49,26 @@ func main() {
45
49
break
46
50
47
51
case N2CMU_NET_CREATE :
52
+ led .Low ()
53
+
48
54
inputCount := uart .ReadUint8 ()
49
55
hiddenCount := uart .ReadUint8 ()
50
56
outputCount := uart .ReadUint8 ()
51
57
52
58
network .InitNetwork (inputCount , hiddenCount , outputCount )
59
+
60
+ led .High ()
53
61
break
54
62
55
63
case N2CMU_NET_RESET :
64
+ led .Low ()
56
65
network .ResetNetwork ()
66
+ led .High ()
57
67
break
58
68
59
69
case N2CMU_NET_TRAIN :
70
+ led .Low ()
71
+
60
72
dataSize := int (uart .ReadUint16 ())
61
73
dataSet := make ([][]float32 , dataSize )
62
74
@@ -86,9 +98,12 @@ func main() {
86
98
}
87
99
88
100
uart .WriteOk ()
101
+ led .High ()
89
102
break
90
103
91
104
case N2CMU_NET_INFER :
105
+ led .Low ()
106
+
92
107
input := make ([]float32 , network .InputCount )
93
108
for j := 0 ; j < int (network .InputCount ); j ++ {
94
109
input [j ] = uart .ReadFloat32 ()
@@ -100,6 +115,7 @@ func main() {
100
115
}
101
116
102
117
uart .WriteOk ()
118
+ led .High ()
103
119
break
104
120
105
121
case N2CMU_SET_INPUT_COUNT :
You can’t perform that action at this time.
0 commit comments