/*
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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment