func (a ADC) Get() uint16 {
	// set the analog reference (high two bits of ADMUX) and select the
	// channel (low 4 bits), masked to only turn on one ADC at a time.
	// set the ADLAR bit (left-adjusted result) to get a value scaled to 16
	// bits. This has the same effect as shifting the return value left by 6
	// bits.
	avr.ADMUX.Set(avr.ADMUX_REFS0 | avr.ADMUX_ADLAR | (uint8(a.Pin) & 0x07))

	// start the conversion
	avr.ADCSRA.SetBits(avr.ADCSRA_ADSC)

	// ADSC is cleared when the conversion finishes
	for ok := true; ok; ok = avr.ADCSRA.HasBits(avr.ADCSRA_ADSC) {
	}

	return uint16(avr.ADCL.Get()) | uint16(avr.ADCH.Get())<<8
}
// Get returns the current value of a ADC pin, in the range 0..0xffff. The AVR
// has an ADC of 10 bits precision so the lower 6 bits will be zero.
Get returns the current value of a ADC pin, in the range 0..0xffff. The AVR
has an ADC of 10 bits precision so the lower 6 bits will be zero.
// Get returns the current value of a ADC pin in the range 0 .. 0xffff . The AVR // has an ADC of 10 bits precision so the lower 6 bits will be zero .
func (a ADC) Get() uint16 {
	avr.ADMUX.Set(avr.ADMUX_REFS0 | avr.ADMUX_ADLAR | (uint8(a.Pin) & 0x07))
	avr.ADCSRA.SetBits(avr.ADCSRA_ADSC)
	for ok := true; ok; ok = avr.ADCSRA.HasBits(avr.ADCSRA_ADSC) {
	}
	return uint16(avr.ADCL.Get()) | uint16(avr.ADCH.Get())<<8
}
func ( a ADC ) Get ( ) uint16 { avr . ADMUX . Set ( avr . ADMUX_REFS0 | avr . ADMUX_ADLAR | ( uint8 ( a . Pin ) & 0x07 ) ) avr . ADCSRA . SetBits ( avr . ADCSRA_ADSC ) for ok := true ; ok ; ok = avr . ADCSRA . HasBits ( avr . ADCSRA_ADSC ) { } return uint16 ( avr . ADCL . Get ( ) ) | uint16 ( avr . ADCH . Get ( ) ) << 8 }
Get returns the current value of a ADC pin, in the range 0..0xffff.
Get returns the current value of a ADC pin in the range 0 .. 0xffff .
// set the analog reference (high two bits of ADMUX) and select the // channel (low 4 bits), masked to only turn on one ADC at a time. // set the ADLAR bit (left-adjusted result) to get a value scaled to 16 // bits. This has the same effect as shifting the return value left by 6 // bits. // start the conversion // ADSC is cleared when the conversion finishes