av/turbidity/results.go

22 lines
529 B
Go

package main
// struct to hold the results of the turbidity sensor.
type Results struct {
turbidity []float64
saturation []float64
contrast []float64
}
func (r *Results) New(n int) {
r.turbidity = make([]float64, n)
r.saturation = make([]float64, n)
r.contrast = make([]float64, n)
}
// Update results to add new values at specified index.
func (r *Results) update(saturation, contrast, turbidity float64, index int) {
r.saturation[index] = saturation
r.contrast[index] = contrast
r.turbidity[index] = turbidity
}