aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/examples/i2s/i2s.go
blob: 06857c48820b1637e52e145bc3fb9ef27986a322 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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([]uint16, 64)

	for {
		// get the next group of samples
		machine.I2S0.ReadMono(data)

		println("data", data[0], data[1], data[2], data[4], "...")
	}
}