Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /opt/www.hb9eik.ch/index.php on line 47

Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /opt/www.hb9eik.ch/index.php on line 48

Warning: Cannot modify header information - headers already sent by (output started at /opt/www.hb9eik.ch/index.php:47) in /opt/www.hb9eik.ch/index.php on line 133
HB9EIK website
HB9EIK Corsi Presentazioni Foto Codice Chi sono  
Immagini del 2010-08-07


Optical Encoder used as analog tuning knob

Arduino driven

Encoder from Nuova Elettronica kit LX1156 (not used)


Test setup


Test setup


Testing with minicom

Source code

#include
#include
int ok = 0;
int sensePin = 11;
volatile int value = 0;

ISR(INT0_vect) {
    value = digitalRead(sensePin);
    ok = 1;
}


void setup() {
    Serial.begin(115200);
    Serial.println("Initializing ihandler");
    pinMode(sensePin, INPUT);
    Serial.println("Processing initialization");
    GICR |= ( 1 << INT0);
    MCUCR |= ( 1 << ISC00);
    MCUCR |= ( 1 << ISC01);
    Serial.println("Finished initialization");
}

void loop() {
    if( ok ) {
        ok = 0;
        if (value) {
            Serial.println("Value high!");
        } else {
            Serial.println("Value low!");
        }
    }
    delay(10);
}