Skip to content

Commit

Permalink
add analog in/out
Browse files Browse the repository at this point in the history
  • Loading branch information
polarspetroll committed Oct 14, 2021
1 parent 541389f commit 5ede6a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wiringpifuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ func (p WiringPiPin) WriteOnInterrupt(v VALUE) {
}
C.close_pin(C.int(p.Num), C.int(val))
}

// returns the analog value for pin(not tested)
func (p WiringPiPin) AnalogRead() int {
return int(C.analogRead(C.int(p.Num)))
}

// writes analog value to pin(not tested)
func (p WiringPiPin) AnalogWrite(val int) {
C.analogWrite(C.int(val))
}

0 comments on commit 5ede6a0

Please # to comment.