mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
c7a23183e8
Go 1.19 started reformatting code in a way that makes it more obvious how it will be rendered on pkg.go.dev. It gets it almost right, but not entirely. Therefore, I had to modify some of the comments so that they are formatted correctly.
25 lines
503 B
Go
25 lines
503 B
Go
// Example using the i2s hardware interface on the Adafruit Circuit Playground Express
|
|
// to read data from the onboard MEMS microphone.
|
|
package main
|
|
|
|
import (
|
|
"machine"
|
|
)
|
|
|
|
func main() {
|
|
machine.I2S0.Configure(machine.I2SConfig{
|
|
Mode: machine.I2SModePDM,
|
|
ClockSource: machine.I2SClockSourceExternal,
|
|
Stereo: true,
|
|
})
|
|
|
|
data := make([]uint32, 64)
|
|
|
|
for {
|
|
// get the next group of samples
|
|
machine.I2S0.Read(data)
|
|
|
|
println("data", data[0], data[1], data[2], data[4], "...")
|
|
}
|
|
}
|