Пример #1
0
func Init(gpioPin int, ledCount int, brightness int) int {
	C.ledstring.channel[0].gpionum = C.int(gpioPin)
	C.ledstring.channel[0].count = C.int(ledCount)
	C.ledstring.channel[0].brightness = C.int(brightness)
	res := int(C.ws2811_init(&C.ledstring))
	return res
}
Пример #2
0
func Init(gpioPin int, ledCount int, brightness int) error {
	C.ledstring.channel[0].gpionum = C.int(gpioPin)
	C.ledstring.channel[0].count = C.int(ledCount)
	C.ledstring.channel[0].brightness = C.int(brightness)
	res := int(C.ws2811_init(&C.ledstring))
	if res == 0 {
		return nil
	} else {
		return errors.New(fmt.Sprintf("Error ws2811.init.%d", res))
	}
}