Browse Source

new file: LICENSE

	new file:   backplane.jpg
	new file:   readme.md
	new file:   top_board.jpg
	new file:   unabkraft.ino
	new file:   yellow_prints.png
Serguei Chmod777 5 years ago
commit
3f4d14f8fd
6 changed files with 346 additions and 0 deletions
  1. 19
    0
      LICENSE
  2. BIN
      backplane.jpg
  3. 28
    0
      readme.md
  4. BIN
      top_board.jpg
  5. 299
    0
      unabkraft.ino
  6. BIN
      yellow_prints.png

+ 19
- 0
LICENSE View File

@@ -0,0 +1,19 @@
1
+    Copyright (C) 2015  serguei.chmod777
2
+
3
+    This program is free software: you can redistribute it and/or modify
4
+    it under the terms of the GNU General Public License as published by
5
+    the Free Software Foundation, either version 3 of the License, or
6
+    (at your option) any later version.
7
+
8
+    This program is distributed in the hope that it will be useful,
9
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
+    GNU General Public License for more details.
12
+
13
+    You should have received a copy of the GNU General Public License
14
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
+    
16
+    --
17
+    So whatever, even if it appears as a nonsense within a GPL one to some
18
+    libre-fundamentalists, don't forget to use OpenBSD anyway, because it's
19
+    cool, and obviously, this system ain't (specially) for integrists!

BIN
backplane.jpg View File


+ 28
- 0
readme.md View File

@@ -0,0 +1,28 @@
1
+```
2
+    As I wrote, it's merely a toy simulating the behavior of... you know, which
3
+starts a running of LEDs, before a buzzer blows up in a frightening ``bip!''.
4
+However, the board could be used for lots of simple RTD tricks.
5
+
6
+    For those who do hacks on a keyboard after checking their hands are clean,
7
+I mean living on OpenBSD (krkrkr), ``avrdude'' exists in the 'ports'.
8
+So, after executing a ``make'' in the dev directory ('cause ``arduinoproject''
9
+creates a sane Makefile), the following line (*) could give a hand for
10
+uploading the code in the Arduino ("nano", I didn't mentioned it, just read the
11
+header of the [sourceCode].ino) :
12
+
13
+#======================upload.sh=========================#
14
+#!/bin/sh
15
+# To be loaded from the current project directory !
16
+avrdude -p atmega328p -P /dev/cuaU0 -c stk500v1 -b 57600        (*)
17
+-U flash:w:applet/unabkraft.hex
18
+#========================================================#
19
+
20
+-- 
21
+The code name's root ain't specifically an ethical allusion, so if you
22
+really wanna figure out where it comes from :
23
+just look for some well known mad mathematician, Ted Kaczynski.
24
+
25
+I want to emphasise that I disclaim forcefully any kind of transformation
26
+of the current project, that would deal with the PWM pins... no need for
27
+further details. Better promote WMP ! http://wmp.tetalab.org/
28
+```

BIN
top_board.jpg View File


+ 299
- 0
unabkraft.ino View File

@@ -0,0 +1,299 @@
1
+/******************************************************************************\
2
+* author        : serguei_chmod77 (Arthur)                                     *
3
+* codename      : unabkraft                                                    *
4
+* testing board : unab77                                                       *
5
+* processor     : at(mel)mega 328p                                             *
6
+* date          : 07.08.2015                                                   *
7
+* version       : 1.5.2                     ``Boolzor powered''                *
8
+*                                           compiler : avrdude, OpenBSD 5.6    *
9
+\******************************************************************************/
10
+
11
+
12
+// Id of digital-pins by nicknames :
13
+const int pushButt = 2;
14
+const int ledBarA = 3, ledBarB = 4, ledBarC = 5, ledBarD = 6, ledBarE = 7;
15
+const int ledBarF = 8, ledBarG = 9, ledBarH = 10, ledBarI = 11;
16
+const int mainLed = 12, bell = 13;
17
+// Some integer variables for arithmetical counts along loop() :
18
+int i = 2000, k = 0, pb = 0, lb = 0, s = 0;
19
+
20
+int lastDebounceTime = 0;
21
+long ctDownSet = 0, dc = 0, cd = 0;
22
+bool zor = true, modeState = false;
23
+
24
+void defusing() {
25
+    zor = false;
26
+}
27
+
28
+void setup(void) {
29
+    // Pins input/output mode global setting :
30
+    pinMode(mainLed, OUTPUT);
31
+    pinMode(ledBarA, OUTPUT);
32
+    pinMode(ledBarB, OUTPUT);
33
+    pinMode(ledBarC, OUTPUT);
34
+    pinMode(ledBarD, OUTPUT);
35
+    pinMode(ledBarE, OUTPUT);
36
+    pinMode(ledBarF, OUTPUT);
37
+    pinMode(ledBarG, OUTPUT);
38
+    pinMode(ledBarH, OUTPUT);
39
+    pinMode(ledBarI, OUTPUT);
40
+    pinMode(bell, OUTPUT);
41
+    pinMode(pushButt, INPUT);
42
+    attachInterrupt(0, defusing, CHANGE);
43
+}
44
+
45
+void thisIsTheEnd() {
46
+
47
+    i = 2000;
48
+    while (i >= 400) {
49
+        if (zor) {
50
+            k=i/2;
51
+            s = i - 50;
52
+            digitalWrite(mainLed, HIGH);
53
+            digitalWrite(bell, HIGH);
54
+            delay(50);
55
+            digitalWrite(bell, LOW);
56
+            delay(s);
57
+            digitalWrite(mainLed, LOW);
58
+            delay(k);
59
+            i -= k;
60
+        }
61
+        else {
62
+            goto lastStraw;
63
+        }
64
+    }
65
+    while (i >= 20) {
66
+        if (zor) {
67
+            digitalWrite(mainLed, HIGH);
68
+            digitalWrite(bell, HIGH);
69
+            delay(i);
70
+            digitalWrite(mainLed, LOW);
71
+            digitalWrite(bell, LOW);
72
+            delay(i);
73
+            i -= 10;
74
+        }
75
+        else {
76
+            goto lastStraw;
77
+        }
78
+    }
79
+    i = 2000;
80
+    // Chenillard final
81
+    lb = 3;
82
+    while (lb < 12) {
83
+        digitalWrite(lb, HIGH);
84
+        delay(400);
85
+        lb ++;
86
+    }
87
+    delay(500);
88
+    lb = 3;
89
+    while (lb < 12) {
90
+        digitalWrite(lb, LOW);
91
+        lb ++;
92
+    }
93
+    lb = 3;
94
+    digitalWrite(bell, HIGH);
95
+    while (lb < 12) {
96
+        digitalWrite(lb, HIGH);
97
+        delay(100);
98
+        digitalWrite(lb, LOW);
99
+        lb ++;
100
+    }
101
+    lb = 10;
102
+    while (lb > 2) {
103
+        digitalWrite(lb, HIGH);
104
+        delay(100);
105
+        digitalWrite(lb, LOW);
106
+        lb --;
107
+    }
108
+    zor = true;
109
+
110
+    lastStraw:
111
+    digitalWrite(bell, LOW);
112
+
113
+}
114
+
115
+void initConditions() {
116
+    delay(300); // interruption debounce, else it'll jump the 'while'
117
+    lb = 3;
118
+    while ( lb < 12 ) {
119
+        digitalWrite(lb, LOW);
120
+        lb ++;
121
+    }
122
+    ctDownSet = 0;
123
+    k = 0;
124
+    dc = 0;
125
+    lastDebounceTime = 0;
126
+    modeState = false;
127
+}
128
+
129
+/* ========================================================================== */
130
+void loop(void) {
131
+    clearSelect:
132
+    initConditions();
133
+
134
+    while ( modeState == false ) {
135
+        if ( ctDownSet < 2700001 ) {
136
+            k=ctDownSet/300000 + 2;
137
+            digitalWrite(k, HIGH);
138
+
139
+            if ( digitalRead(pushButt) == LOW ) {
140
+                lastDebounceTime = millis();
141
+                delay(300); // debounce
142
+                            // check if the switch is pressed for a long time
143
+                if( digitalRead(pushButt) == LOW && ( lastDebounceTime - millis() ) > 5000 ) {
144
+                    modeState = true;
145
+                    i=0;
146
+                    while( i<2 ) {
147
+                        digitalWrite(bell, HIGH);
148
+                        delay(200);
149
+                        digitalWrite(bell, LOW);
150
+                        delay(200);
151
+                        i++;
152
+                    }
153
+                    delay(700);
154
+                    goto sayByBye;
155
+                }
156
+                // otherwise (short pressure), just increment the countdown delay
157
+                else {
158
+                ctDownSet += 300000;
159
+                digitalWrite(mainLed, HIGH);
160
+                delay(300);
161
+                digitalWrite(mainLed, LOW);
162
+                }
163
+            }
164
+        }
165
+        else {
166
+            goto clearSelect;
167
+        }
168
+    }
169
+
170
+    sayByBye:
171
+    zor = true;
172
+    if (zor) {
173
+        if ( ctDownSet != 0 ) {
174
+            k=ctDownSet/300000;
175
+            while ( k > 1 ) {
176
+                //delay(300000);
177
+                dc = 0;
178
+
179
+                countDown:
180
+
181
+                while ( dc < 300001 ) {
182
+                    if (zor) {
183
+                        delay(10);
184
+                        dc += 10;
185
+                    }
186
+                    else {
187
+                        i = 0;
188
+                        while ( i < 2 ) {
189
+                            digitalWrite(mainLed, HIGH);
190
+                            delay(300);
191
+                            digitalWrite(mainLed, LOW);
192
+                            delay(300);
193
+                            i ++;
194
+                        }
195
+                        cd = 0;
196
+                        while ( cd < 10001 ) {
197
+                            delay(10);
198
+                            cd += 10;
199
+                        }
200
+                        zor = true;
201
+                        delay(400);
202
+                        if (zor) {
203
+                            i = 0;
204
+                            while ( i < 2 ) {
205
+                                digitalWrite(mainLed, HIGH);
206
+                                delay(300);
207
+                                digitalWrite(mainLed, LOW);
208
+                                delay(300);
209
+                                i ++;
210
+                            }
211
+                            goto countDown;
212
+                        }
213
+                        else {
214
+                            goto jackFlash;
215
+                        }
216
+                    }
217
+                }
218
+                digitalWrite(k+2, LOW);
219
+                digitalWrite(k+1, HIGH);
220
+                k --;
221
+            }
222
+
223
+            dc = 0;
224
+
225
+            takeFive:
226
+
227
+            while ( dc < 300001 ) {
228
+                if (zor) {
229
+                    delay(10);
230
+                    dc += 10;
231
+                }
232
+                else {
233
+                    i = 0;
234
+                    while ( i < 2 ) {
235
+                        digitalWrite(mainLed, HIGH);
236
+                        delay(300);
237
+                        digitalWrite(mainLed, LOW);
238
+                        delay(300);
239
+                        i ++;
240
+                    }
241
+                    cd = 0;
242
+                    while ( cd < 10001 ) {
243
+                        delay(10);
244
+                        cd += 10;
245
+                    }
246
+                    zor = true;
247
+                    delay(400);
248
+                    if (zor) {
249
+                        i = 0;
250
+                        while ( i < 2 ) {
251
+                            digitalWrite(mainLed, HIGH);
252
+                            delay(300);
253
+                            digitalWrite(mainLed, LOW);
254
+                            delay(300);
255
+                            i ++;
256
+                        }
257
+                        goto takeFive;
258
+                    }
259
+                    else {
260
+                        goto jackFlash;
261
+                    }
262
+                }
263
+            }
264
+            digitalWrite(3, LOW);
265
+        }
266
+    }
267
+
268
+    jackFlash:
269
+
270
+    if (zor) {
271
+        thisIsTheEnd();
272
+        if ( zor == false ) {
273
+            k = 11;
274
+            while ( k > 2 ) {
275
+                digitalWrite(k, HIGH);
276
+                k --;
277
+            }
278
+            k = 9;
279
+            goto defuseSign;
280
+        }
281
+    }
282
+
283
+    else {
284
+
285
+        defuseSign:
286
+        lb = k + 2;
287
+        while ( lb > 2 ) {
288
+            digitalWrite(bell, HIGH);
289
+            digitalWrite(lb, LOW);
290
+            delay(500 - lb*25);
291
+            digitalWrite(bell, LOW);
292
+            delay(200 - lb*15);
293
+            lb --;
294
+        }
295
+
296
+    }
297
+
298
+    return;
299
+}

BIN
yellow_prints.png View File


Loading…
Cancel
Save