diff --git a/projekte/charlieplexing/eagle/4pins.sch b/projekte/charlieplexing/eagle/4pins.sch new file mode 100644 index 0000000..029a829 Binary files /dev/null and b/projekte/charlieplexing/eagle/4pins.sch differ diff --git a/projekte/charlieplexing/eagle/eagle.epf b/projekte/charlieplexing/eagle/eagle.epf new file mode 100644 index 0000000..b2b33d6 --- /dev/null +++ b/projekte/charlieplexing/eagle/eagle.epf @@ -0,0 +1,2 @@ +[Eagle] +Version="05 07 00" \ No newline at end of file diff --git a/projekte/charlieplexing/sketch_may18a/sketch_may18a.pde b/projekte/charlieplexing/sketch_may18a/sketch_may18a.pde new file mode 100644 index 0000000..e56cf89 --- /dev/null +++ b/projekte/charlieplexing/sketch_may18a/sketch_may18a.pde @@ -0,0 +1,32 @@ +const int pins[] = {2, 3, 4}; + +void setup() { + for(int p=0; p<=2; p++) { + pinMode(pins[p], INPUT); + } +} + +const int charlieplexed[6][3] = +{ + { 1,0,-1}, + { 0,1,-1}, + {-1,1, 0}, + {-1,0, 1}, + {1,-1, 0}, + {0,-1, 1}, +}; + +void loop() { + for(int i=0; i<=5; i++) { + // set pin tristate + for(int p=0; p<=2; p++) { + if (charlieplexed[i][p] == -1) { + pinMode(pins[p], INPUT); + } else { + pinMode(pins[p], OUTPUT); + digitalWrite(pins[p], charlieplexed[i][p]); + } + } + delay(200); + } +} diff --git a/projekte/charlieplexing/sketch_may18b/sketch_may18b.pde b/projekte/charlieplexing/sketch_may18b/sketch_may18b.pde new file mode 100644 index 0000000..ccbec3d --- /dev/null +++ b/projekte/charlieplexing/sketch_may18b/sketch_may18b.pde @@ -0,0 +1,38 @@ +const int pins[] = {2, 3, 4, 5}; + +void setup() { + for(int p=0; p<=2; p++) { + pinMode(pins[p], INPUT); + } +} + +const int charlieplexed[12][4] = +{ + { 1,0,-1, -1}, + { 0,1,-1, -1}, + {-1,1, 0, -1}, + {-1,0, 1, -1}, + {-1,-1,1, 0}, + {-1,-1,0, 1}, + {1,-1, 0, -1}, + {0,-1, 1, -1}, + {-1,1,-1, 0}, + {-1,0,-1, 1}, + {1,-1,-1, 0}, + {0,-1,-1, 1}, +}; + +void loop() { + for(int i=0; i<=11; i++) { + // set pin tristate + for(int p=0; p<=3; p++) { + if (charlieplexed[i][p] == -1) { + pinMode(pins[p], INPUT); + } else { + pinMode(pins[p], OUTPUT); + digitalWrite(pins[p], charlieplexed[i][p]); + } + } + delay(200); + } +}