i read this tutorial: http://codeandlife.com/2012/01/22/avr-a ... al-part-1/ , and the same author wrote a How-To for making an USB-Keyboard via the HID-class, which worked wonderful for me
Slot
Code: Select all
//voltage reader.
#define ADC_VREF_TYPE 0x40
static int read_adc(unsigned char adc_input)
{
   ADMUX=adc_input|ADC_VREF_TYPE;
    _delay_us(150);
    ADCSRA|=0x40; // Start the AD conversion
    while ((ADCSRA & 0x10)==0);// Wait for complete
    ADCSRA|=0x10;
    return ADCW;
} 
Code: Select all
   ADMUX=0x1;//ADC init
   ADCSRA=0x83;Code: Select all
      reportBuffer[1]= (read_adc(0)/3 + 200);//pc0
      reportBuffer[2]= (read_adc(1)/3 + 200)*-1;//pc1