diff options
author | Ayke van Laethem <[email protected]> | 2019-04-28 18:49:17 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-05-26 20:48:50 +0200 |
commit | 94b8214529f1cebad2cc45b5c1820695a7dd8201 (patch) | |
tree | 62ea7f3171ba0a3f106998e2ddc8ed1c7e799f59 /src/examples/button | |
parent | 421ef04efb87889d73d5b404202a655f41d2e1e4 (diff) | |
download | tinygo-94b8214529f1cebad2cc45b5c1820695a7dd8201.tar.gz tinygo-94b8214529f1cebad2cc45b5c1820695a7dd8201.zip |
machine: refactor pins to be of Pin type
Diffstat (limited to 'src/examples/button')
-rw-r--r-- | src/examples/button/button.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/examples/button/button.go b/src/examples/button/button.go index 30261b8c9..8c245cdae 100644 --- a/src/examples/button/button.go +++ b/src/examples/button/button.go @@ -7,14 +7,14 @@ import ( // This example assumes that the button is connected to pin 8. Change the value // below to use a different pin. -const buttonPin = 8 +const ( + led = machine.LED + button = machine.Pin(8) +) func main() { - led := machine.GPIO{machine.LED} - led.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT}) - - button := machine.GPIO{buttonPin} - button.Configure(machine.GPIOConfig{Mode: machine.GPIO_INPUT}) + led.Configure(machine.PinConfig{Mode: machine.PinOutput}) + button.Configure(machine.PinConfig{Mode: machine.PinInput}) for { if button.Get() { |