You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-1
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ go get tinygo.org/x/drivers
16
16
17
17
## How to use
18
18
19
-
Here is an example in TinyGo that uses the BMP180 digital barometer:
19
+
Here is an example in TinyGo that uses the BMP180 digital barometer. This example should work on any board that supports I2C:
20
20
21
21
```go
22
22
package main
@@ -53,6 +53,28 @@ func main() {
53
53
}
54
54
```
55
55
56
+
## Examples Using GPIO or SPI
57
+
58
+
If compiling these examples directly you are likely to need to make minor changes to the defined variables to map the pins for the board you are using. For example, this block in main.go:
59
+
60
+
```golang
61
+
var (
62
+
spi = machine.SPI0
63
+
csPin = machine.D5
64
+
)
65
+
```
66
+
67
+
It might not be obvious, but you need to change these to match how you wired your specific board. Constants are [defined for each supported microcontroller](https://tinygo.org/docs/reference/microcontrollers/).
68
+
69
+
For example, to change the definitions for use on a Raspberry Pi Pico using typical wiring, you might need to do this:
0 commit comments