Skip to content

Commit 5ede6a0

Browse files
author
polarspetroll
committed
add analog in/out
1 parent 541389f commit 5ede6a0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

wiringpifuncs.go

+10
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,13 @@ func (p WiringPiPin) WriteOnInterrupt(v VALUE) {
5353
}
5454
C.close_pin(C.int(p.Num), C.int(val))
5555
}
56+
57+
// returns the analog value for pin(not tested)
58+
func (p WiringPiPin) AnalogRead() int {
59+
return int(C.analogRead(C.int(p.Num)))
60+
}
61+
62+
// writes analog value to pin(not tested)
63+
func (p WiringPiPin) AnalogWrite(val int) {
64+
C.analogWrite(C.int(val))
65+
}

0 commit comments

Comments
 (0)