/*
Bar Graph Toggle From Keyboard
*/
int c;
void setup() {
Serial.begin(9600);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
digitalWrite( 3, HIGH);
digitalWrite( 4, HIGH);
digitalWrite( 5, HIGH);
digitalWrite( 6, HIGH);
digitalWrite( 7, HIGH);
digitalWrite( 8, HIGH);
digitalWrite( 9, HIGH);
digitalWrite(10, HIGH);
}
void loop() {
if (Serial.available()) {
c = Serial.read();
if (c >= '1' && c <= '8') {
c = c & 0x0f; // Convert ascii to int
c += 2; // pins 3-10 == keys 1-8
digitalWrite(c, !digitalRead(c)); // Toggle pin
}
}
}
Wednesday, October 21, 2009
Bar Graph Toggle From Keyboard
Wednesday, October 14, 2009
setterm -blank
"setterm -blank
nn will tell the console driver to blank the screen after nn minutes of inactivity. (With nn = 0, screensaving is turned off. In some old kernels this first took effect after the next keyboard interrupt.) -- Linux Keyboard and Console HOWTO
Wednesday, October 7, 2009
Arduino as a clock source
Arduino as a 1MHz clock...
Fastest Arduino (16MHz) output: 1.6MHz
/* 1MHz Clock */
int ledPin = 7;
void setup() {
pinMode(ledPin, OUTPUT);
noInterrupts();
}
void loop() {
PORTD ^= 10000000;
asm("NOP");
asm("NOP");
asm("NOP");
}
Fastest Arduino (16MHz) output: 1.6MHz
Subscribe to:
Posts (Atom)