2021-12-17 09:03:31 +03:00
|
|
|
package main
|
|
|
|
|
2021-12-21 08:03:21 +03:00
|
|
|
// struct to hold the results of the turbidity sensor.
|
2021-12-17 09:03:31 +03:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2021-12-21 08:03:21 +03:00
|
|
|
// Update results to add new values at specified index.
|
|
|
|
func (r *Results) Update(saturation, contrast, turbidity float64, index int) {
|
2021-12-21 04:43:05 +03:00
|
|
|
r.saturation[index] = saturation
|
|
|
|
r.contrast[index] = contrast
|
|
|
|
r.turbidity[index] = turbidity
|
|
|
|
}
|