Skip to content

Commit 0ffcc34

Browse files
committed
Blinking PC13 LED on network functionality request.
1 parent 1258c2c commit 0ffcc34

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

main.go

+16
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ func main() {
2828
var network n2.NeuralNetwork
2929
var epoch uint16 = 0
3030

31+
led := machine.PC13
32+
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
33+
led.High()
34+
3135
machine.UART1.SetBaudRate(31250)
3236
for {
3337
command, error := machine.Serial.ReadByte()
@@ -45,18 +49,26 @@ func main() {
4549
break
4650

4751
case N2CMU_NET_CREATE:
52+
led.Low()
53+
4854
inputCount := uart.ReadUint8()
4955
hiddenCount := uart.ReadUint8()
5056
outputCount := uart.ReadUint8()
5157

5258
network.InitNetwork(inputCount, hiddenCount, outputCount)
59+
60+
led.High()
5361
break
5462

5563
case N2CMU_NET_RESET:
64+
led.Low()
5665
network.ResetNetwork()
66+
led.High()
5767
break
5868

5969
case N2CMU_NET_TRAIN:
70+
led.Low()
71+
6072
dataSize := int(uart.ReadUint16())
6173
dataSet := make([][]float32, dataSize)
6274

@@ -86,9 +98,12 @@ func main() {
8698
}
8799

88100
uart.WriteOk()
101+
led.High()
89102
break
90103

91104
case N2CMU_NET_INFER:
105+
led.Low()
106+
92107
input := make([]float32, network.InputCount)
93108
for j := 0; j < int(network.InputCount); j++ {
94109
input[j] = uart.ReadFloat32()
@@ -100,6 +115,7 @@ func main() {
100115
}
101116

102117
uart.WriteOk()
118+
led.High()
103119
break
104120

105121
case N2CMU_SET_INPUT_COUNT:

0 commit comments

Comments
 (0)