move stuff
This commit is contained in:
		
							parent
							
								
									cc49225717
								
							
						
					
					
						commit
						3f524bc360
					
				
					 6 changed files with 0 additions and 0 deletions
				
			
		
							
								
								
									
										65
									
								
								projekte/lc-display/sketch_nov03a/sketch_nov03a.pde
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								projekte/lc-display/sketch_nov03a/sketch_nov03a.pde
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
#include <avr/interrupt.h>
 | 
			
		||||
#include <avr/io.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int pinA = 11;
 | 
			
		||||
int pinB = 12;
 | 
			
		||||
int ledPin = 13;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  //Timer2 Settings
 | 
			
		||||
  TCCR2A = 0;
 | 
			
		||||
  TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;
 | 
			
		||||
 | 
			
		||||
  //Timer2 Overflow Interrupt Enable
 | 
			
		||||
  TIMSK2 = 1<<TOIE2;
 | 
			
		||||
 | 
			
		||||
  // pullups  
 | 
			
		||||
  digitalWrite(pinA, HIGH); 
 | 
			
		||||
  digitalWrite(pinB, HIGH); 
 | 
			
		||||
  
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
volatile int8_t enc_delta;			// -128 ... 127
 | 
			
		||||
static int8_t last;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ISR(TIMER2_OVF_vect) {
 | 
			
		||||
  int8_t neu, diff;
 | 
			
		||||
 | 
			
		||||
  // convert gray to binary 
 | 
			
		||||
  neu = 0;
 | 
			
		||||
  if(digitalRead(pinA))
 | 
			
		||||
    neu = 3;
 | 
			
		||||
  if(digitalRead(pinB))
 | 
			
		||||
    neu ^= 1;
 | 
			
		||||
    
 | 
			
		||||
  diff = last - neu;				// difference last - new
 | 
			
		||||
  if( diff & 1 ) {				// bit 0 = value (1)
 | 
			
		||||
    last = neu;					// store new as next last
 | 
			
		||||
    enc_delta += (diff & 2) - 1;		// bit 1 = direction (+/-)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int8_t val_alt;
 | 
			
		||||
void loop() {
 | 
			
		||||
  int8_t val;
 | 
			
		||||
 | 
			
		||||
  digitalWrite(13,HIGH);
 | 
			
		||||
 | 
			
		||||
  cli();
 | 
			
		||||
  val = enc_delta;
 | 
			
		||||
  // enc_delta = val & 1;
 | 
			
		||||
  sei();
 | 
			
		||||
  
 | 
			
		||||
  if (val != val_alt) {
 | 
			
		||||
    Serial.println(val>>1);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  val_alt = val;
 | 
			
		||||
  
 | 
			
		||||
  delay(100);
 | 
			
		||||
  digitalWrite(13,LOW);
 | 
			
		||||
  delay(100);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								projekte/lc-display/sketch_oct13b/sketch_oct13b.pde
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								projekte/lc-display/sketch_oct13b/sketch_oct13b.pde
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
int pinA = 11;
 | 
			
		||||
int pinB = 12;
 | 
			
		||||
int pinLED = 13;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
  pinMode(pinA, INPUT);
 | 
			
		||||
  digitalWrite(pinA, HIGH); 
 | 
			
		||||
  pinMode(pinB, INPUT);
 | 
			
		||||
  digitalWrite(pinB, HIGH); 
 | 
			
		||||
  pinMode(pinLED, OUTPUT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int a_old, b_old, dreh;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  // shall we blink
 | 
			
		||||
  //  if (millis() - prevMillis > 100) {
 | 
			
		||||
  //    prevMillis = millis();
 | 
			
		||||
  //    
 | 
			
		||||
  //    if (pinLEDstate == LOW) 
 | 
			
		||||
  //      pinLEDstate = HIGH;
 | 
			
		||||
  //    else 
 | 
			
		||||
  //      pinLEDstate = LOW;
 | 
			
		||||
  //    digitalWrite(pinLED, pinLEDstate);
 | 
			
		||||
  //    
 | 
			
		||||
  int a = digitalRead(pinA);
 | 
			
		||||
  int b = digitalRead(pinB);
 | 
			
		||||
 | 
			
		||||
  if (a != a_old || b != b_old) {
 | 
			
		||||
    Serial.print(digitalRead(pinA));
 | 
			
		||||
    Serial.print(" ");
 | 
			
		||||
    Serial.print(digitalRead(pinB));
 | 
			
		||||
    Serial.println();
 | 
			
		||||
    dreh++;
 | 
			
		||||
    // Serial.println("C:> _");
 | 
			
		||||
  } 
 | 
			
		||||
 | 
			
		||||
  digitalWrite(pinLED, a);
 | 
			
		||||
  a_old = a; 
 | 
			
		||||
  b_old = b;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								projekte/lc-display/sketch_oct20a/sketch_oct20a.pde
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								projekte/lc-display/sketch_oct20a/sketch_oct20a.pde
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
#include <LCD4Bit.h>
 | 
			
		||||
LCD4Bit lcd = LCD4Bit(2);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  lcd.init();
 | 
			
		||||
  lcd.clear();
 | 
			
		||||
  lcd.printIn("World Arduinination in progress...");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int i = 0,j = 0, dir = 1;
 | 
			
		||||
char bfr[4];
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  digitalWrite(13, HIGH);
 | 
			
		||||
 | 
			
		||||
  lcd.cursorTo(2, 0);
 | 
			
		||||
  itoa(i, bfr, 10);
 | 
			
		||||
  lcd.printIn(bfr);
 | 
			
		||||
  lcd.printIn("%");
 | 
			
		||||
  
 | 
			
		||||
  lcd.cursorTo(2, 4);
 | 
			
		||||
  
 | 
			
		||||
  for(j=0; j < (i / 3); j++)
 | 
			
		||||
      lcd.print(255);
 | 
			
		||||
  for(j=i/3; j < 100/3; j++)
 | 
			
		||||
      lcd.printIn(" ");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
  if(i >= 98)
 | 
			
		||||
    dir = -1;
 | 
			
		||||
  if(dir == -1 && i <= 80)
 | 
			
		||||
    dir = 1;
 | 
			
		||||
    
 | 
			
		||||
  i += dir;
 | 
			
		||||
  
 | 
			
		||||
  digitalWrite(13,LOW);
 | 
			
		||||
  delay(100);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								projekte/lc-display/sketch_oct27a/sketch_oct27a.pde
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								projekte/lc-display/sketch_oct27a/sketch_oct27a.pde
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
#include <LCD4Bit.h>
 | 
			
		||||
LCD4Bit lcd = LCD4Bit(2);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  lcd.init();
 | 
			
		||||
  lcd.clear();
 | 
			
		||||
 | 
			
		||||
  // create char
 | 
			
		||||
  lcd.commandWrite(0x40);
 | 
			
		||||
  lcd.print(0b10001);
 | 
			
		||||
  lcd.print(0b01010);
 | 
			
		||||
  lcd.print(0b10101);
 | 
			
		||||
  lcd.print(0b11111);
 | 
			
		||||
  lcd.print(0b01110);
 | 
			
		||||
  lcd.print(0b10001);
 | 
			
		||||
  lcd.print(0b10001);
 | 
			
		||||
  lcd.print(0b01010);
 | 
			
		||||
 | 
			
		||||
  // back to normal
 | 
			
		||||
  lcd.cursorTo(1,0);
 | 
			
		||||
  for(uint8_t i = 0; i < 80; i++) {
 | 
			
		||||
    lcd.print(0x00+(i&0x7));
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  digitalWrite(13, HIGH);
 | 
			
		||||
 | 
			
		||||
  lcd.commandWrite(0x40+8*random(8));
 | 
			
		||||
  uint8_t fnord = random(8);
 | 
			
		||||
  for (uint8_t i = 0; i<8; i++) {
 | 
			
		||||
    if(i == fnord) {
 | 
			
		||||
      lcd.print(0b11111);
 | 
			
		||||
    } else {
 | 
			
		||||
      lcd.print(0b00000);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  digitalWrite(13,LOW);
 | 
			
		||||
  delay(10);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										49
									
								
								projekte/lc-display/sketch_sep29a/sketch_sep29a.pde
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								projekte/lc-display/sketch_sep29a/sketch_sep29a.pde
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
int pinA = 7;
 | 
			
		||||
int pinB = 8;
 | 
			
		||||
int pinLED = 13;
 | 
			
		||||
int pinLEDstate = LOW;
 | 
			
		||||
long prevMillis = 0;
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  Serial.begin(9600);
 | 
			
		||||
  pinMode(pinA, INPUT);
 | 
			
		||||
  digitalWrite(pinA, HIGH); 
 | 
			
		||||
  pinMode(pinB, INPUT);
 | 
			
		||||
  digitalWrite(pinB, HIGH); 
 | 
			
		||||
  pinMode(pinLED, OUTPUT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int a_old, b_old, dreh;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  // shall we blink
 | 
			
		||||
//  if (millis() - prevMillis > 100) {
 | 
			
		||||
//    prevMillis = millis();
 | 
			
		||||
//    
 | 
			
		||||
//    if (pinLEDstate == LOW) 
 | 
			
		||||
//      pinLEDstate = HIGH;
 | 
			
		||||
//    else 
 | 
			
		||||
//      pinLEDstate = LOW;
 | 
			
		||||
//    digitalWrite(pinLED, pinLEDstate);
 | 
			
		||||
//    
 | 
			
		||||
  int a = digitalRead(pinA);
 | 
			
		||||
  int b = digitalRead(pinB);
 | 
			
		||||
 | 
			
		||||
  if (a != a_old || b != b_old) {
 | 
			
		||||
    Serial.print(digitalRead(pinA));
 | 
			
		||||
    Serial.print(" ");
 | 
			
		||||
    Serial.print(digitalRead(pinB));
 | 
			
		||||
    Serial.println();
 | 
			
		||||
    dreh++;
 | 
			
		||||
    // Serial.println("C:> _");
 | 
			
		||||
  } else {
 | 
			
		||||
    if (dreh%2 == 0) {
 | 
			
		||||
      Serial.println();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  digitalWrite(pinLED, a);
 | 
			
		||||
  a_old = a; b_old = b;
 | 
			
		||||
}
 | 
			
		||||
		Reference in a new issue