aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/examples/i2s/i2s.go
blob: 4936d92ff55d92defaf3ea7ab653ec4eb928ef1d (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([]uint32, 64)

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

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