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
This commit is contained in:
commit
3f4d14f8fd
19
LICENSE
Normal file
19
LICENSE
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (C) 2015 serguei.chmod777
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
--
|
||||||
|
So whatever, even if it appears as a nonsense within a GPL one to some
|
||||||
|
libre-fundamentalists, don't forget to use OpenBSD anyway, because it's
|
||||||
|
cool, and obviously, this system ain't (specially) for integrists!
|
BIN
backplane.jpg
Normal file
BIN
backplane.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
28
readme.md
Normal file
28
readme.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
```
|
||||||
|
As I wrote, it's merely a toy simulating the behavior of... you know, which
|
||||||
|
starts a running of LEDs, before a buzzer blows up in a frightening ``bip!''.
|
||||||
|
However, the board could be used for lots of simple RTD tricks.
|
||||||
|
|
||||||
|
For those who do hacks on a keyboard after checking their hands are clean,
|
||||||
|
I mean living on OpenBSD (krkrkr), ``avrdude'' exists in the 'ports'.
|
||||||
|
So, after executing a ``make'' in the dev directory ('cause ``arduinoproject''
|
||||||
|
creates a sane Makefile), the following line (*) could give a hand for
|
||||||
|
uploading the code in the Arduino ("nano", I didn't mentioned it, just read the
|
||||||
|
header of the [sourceCode].ino) :
|
||||||
|
|
||||||
|
#======================upload.sh=========================#
|
||||||
|
#!/bin/sh
|
||||||
|
# To be loaded from the current project directory !
|
||||||
|
avrdude -p atmega328p -P /dev/cuaU0 -c stk500v1 -b 57600 (*)
|
||||||
|
-U flash:w:applet/unabkraft.hex
|
||||||
|
#========================================================#
|
||||||
|
|
||||||
|
--
|
||||||
|
The code name's root ain't specifically an ethical allusion, so if you
|
||||||
|
really wanna figure out where it comes from :
|
||||||
|
just look for some well known mad mathematician, Ted Kaczynski.
|
||||||
|
|
||||||
|
I want to emphasise that I disclaim forcefully any kind of transformation
|
||||||
|
of the current project, that would deal with the PWM pins... no need for
|
||||||
|
further details. Better promote WMP ! http://wmp.tetalab.org/
|
||||||
|
```
|
BIN
top_board.jpg
Normal file
BIN
top_board.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
299
unabkraft.ino
Normal file
299
unabkraft.ino
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
/******************************************************************************\
|
||||||
|
* author : serguei_chmod77 (Arthur) *
|
||||||
|
* codename : unabkraft *
|
||||||
|
* testing board : unab77 *
|
||||||
|
* processor : at(mel)mega 328p *
|
||||||
|
* date : 07.08.2015 *
|
||||||
|
* version : 1.5.2 ``Boolzor powered'' *
|
||||||
|
* compiler : avrdude, OpenBSD 5.6 *
|
||||||
|
\******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
// Id of digital-pins by nicknames :
|
||||||
|
const int pushButt = 2;
|
||||||
|
const int ledBarA = 3, ledBarB = 4, ledBarC = 5, ledBarD = 6, ledBarE = 7;
|
||||||
|
const int ledBarF = 8, ledBarG = 9, ledBarH = 10, ledBarI = 11;
|
||||||
|
const int mainLed = 12, bell = 13;
|
||||||
|
// Some integer variables for arithmetical counts along loop() :
|
||||||
|
int i = 2000, k = 0, pb = 0, lb = 0, s = 0;
|
||||||
|
|
||||||
|
int lastDebounceTime = 0;
|
||||||
|
long ctDownSet = 0, dc = 0, cd = 0;
|
||||||
|
bool zor = true, modeState = false;
|
||||||
|
|
||||||
|
void defusing() {
|
||||||
|
zor = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(void) {
|
||||||
|
// Pins input/output mode global setting :
|
||||||
|
pinMode(mainLed, OUTPUT);
|
||||||
|
pinMode(ledBarA, OUTPUT);
|
||||||
|
pinMode(ledBarB, OUTPUT);
|
||||||
|
pinMode(ledBarC, OUTPUT);
|
||||||
|
pinMode(ledBarD, OUTPUT);
|
||||||
|
pinMode(ledBarE, OUTPUT);
|
||||||
|
pinMode(ledBarF, OUTPUT);
|
||||||
|
pinMode(ledBarG, OUTPUT);
|
||||||
|
pinMode(ledBarH, OUTPUT);
|
||||||
|
pinMode(ledBarI, OUTPUT);
|
||||||
|
pinMode(bell, OUTPUT);
|
||||||
|
pinMode(pushButt, INPUT);
|
||||||
|
attachInterrupt(0, defusing, CHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void thisIsTheEnd() {
|
||||||
|
|
||||||
|
i = 2000;
|
||||||
|
while (i >= 400) {
|
||||||
|
if (zor) {
|
||||||
|
k=i/2;
|
||||||
|
s = i - 50;
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
digitalWrite(bell, HIGH);
|
||||||
|
delay(50);
|
||||||
|
digitalWrite(bell, LOW);
|
||||||
|
delay(s);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
delay(k);
|
||||||
|
i -= k;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto lastStraw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (i >= 20) {
|
||||||
|
if (zor) {
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
digitalWrite(bell, HIGH);
|
||||||
|
delay(i);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
digitalWrite(bell, LOW);
|
||||||
|
delay(i);
|
||||||
|
i -= 10;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto lastStraw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i = 2000;
|
||||||
|
// Chenillard final
|
||||||
|
lb = 3;
|
||||||
|
while (lb < 12) {
|
||||||
|
digitalWrite(lb, HIGH);
|
||||||
|
delay(400);
|
||||||
|
lb ++;
|
||||||
|
}
|
||||||
|
delay(500);
|
||||||
|
lb = 3;
|
||||||
|
while (lb < 12) {
|
||||||
|
digitalWrite(lb, LOW);
|
||||||
|
lb ++;
|
||||||
|
}
|
||||||
|
lb = 3;
|
||||||
|
digitalWrite(bell, HIGH);
|
||||||
|
while (lb < 12) {
|
||||||
|
digitalWrite(lb, HIGH);
|
||||||
|
delay(100);
|
||||||
|
digitalWrite(lb, LOW);
|
||||||
|
lb ++;
|
||||||
|
}
|
||||||
|
lb = 10;
|
||||||
|
while (lb > 2) {
|
||||||
|
digitalWrite(lb, HIGH);
|
||||||
|
delay(100);
|
||||||
|
digitalWrite(lb, LOW);
|
||||||
|
lb --;
|
||||||
|
}
|
||||||
|
zor = true;
|
||||||
|
|
||||||
|
lastStraw:
|
||||||
|
digitalWrite(bell, LOW);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void initConditions() {
|
||||||
|
delay(300); // interruption debounce, else it'll jump the 'while'
|
||||||
|
lb = 3;
|
||||||
|
while ( lb < 12 ) {
|
||||||
|
digitalWrite(lb, LOW);
|
||||||
|
lb ++;
|
||||||
|
}
|
||||||
|
ctDownSet = 0;
|
||||||
|
k = 0;
|
||||||
|
dc = 0;
|
||||||
|
lastDebounceTime = 0;
|
||||||
|
modeState = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================================================== */
|
||||||
|
void loop(void) {
|
||||||
|
clearSelect:
|
||||||
|
initConditions();
|
||||||
|
|
||||||
|
while ( modeState == false ) {
|
||||||
|
if ( ctDownSet < 2700001 ) {
|
||||||
|
k=ctDownSet/300000 + 2;
|
||||||
|
digitalWrite(k, HIGH);
|
||||||
|
|
||||||
|
if ( digitalRead(pushButt) == LOW ) {
|
||||||
|
lastDebounceTime = millis();
|
||||||
|
delay(300); // debounce
|
||||||
|
// check if the switch is pressed for a long time
|
||||||
|
if( digitalRead(pushButt) == LOW && ( lastDebounceTime - millis() ) > 5000 ) {
|
||||||
|
modeState = true;
|
||||||
|
i=0;
|
||||||
|
while( i<2 ) {
|
||||||
|
digitalWrite(bell, HIGH);
|
||||||
|
delay(200);
|
||||||
|
digitalWrite(bell, LOW);
|
||||||
|
delay(200);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
delay(700);
|
||||||
|
goto sayByBye;
|
||||||
|
}
|
||||||
|
// otherwise (short pressure), just increment the countdown delay
|
||||||
|
else {
|
||||||
|
ctDownSet += 300000;
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
delay(300);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto clearSelect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sayByBye:
|
||||||
|
zor = true;
|
||||||
|
if (zor) {
|
||||||
|
if ( ctDownSet != 0 ) {
|
||||||
|
k=ctDownSet/300000;
|
||||||
|
while ( k > 1 ) {
|
||||||
|
//delay(300000);
|
||||||
|
dc = 0;
|
||||||
|
|
||||||
|
countDown:
|
||||||
|
|
||||||
|
while ( dc < 300001 ) {
|
||||||
|
if (zor) {
|
||||||
|
delay(10);
|
||||||
|
dc += 10;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
i = 0;
|
||||||
|
while ( i < 2 ) {
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
delay(300);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
delay(300);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
cd = 0;
|
||||||
|
while ( cd < 10001 ) {
|
||||||
|
delay(10);
|
||||||
|
cd += 10;
|
||||||
|
}
|
||||||
|
zor = true;
|
||||||
|
delay(400);
|
||||||
|
if (zor) {
|
||||||
|
i = 0;
|
||||||
|
while ( i < 2 ) {
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
delay(300);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
delay(300);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
goto countDown;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto jackFlash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
digitalWrite(k+2, LOW);
|
||||||
|
digitalWrite(k+1, HIGH);
|
||||||
|
k --;
|
||||||
|
}
|
||||||
|
|
||||||
|
dc = 0;
|
||||||
|
|
||||||
|
takeFive:
|
||||||
|
|
||||||
|
while ( dc < 300001 ) {
|
||||||
|
if (zor) {
|
||||||
|
delay(10);
|
||||||
|
dc += 10;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
i = 0;
|
||||||
|
while ( i < 2 ) {
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
delay(300);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
delay(300);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
cd = 0;
|
||||||
|
while ( cd < 10001 ) {
|
||||||
|
delay(10);
|
||||||
|
cd += 10;
|
||||||
|
}
|
||||||
|
zor = true;
|
||||||
|
delay(400);
|
||||||
|
if (zor) {
|
||||||
|
i = 0;
|
||||||
|
while ( i < 2 ) {
|
||||||
|
digitalWrite(mainLed, HIGH);
|
||||||
|
delay(300);
|
||||||
|
digitalWrite(mainLed, LOW);
|
||||||
|
delay(300);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
goto takeFive;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto jackFlash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
digitalWrite(3, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jackFlash:
|
||||||
|
|
||||||
|
if (zor) {
|
||||||
|
thisIsTheEnd();
|
||||||
|
if ( zor == false ) {
|
||||||
|
k = 11;
|
||||||
|
while ( k > 2 ) {
|
||||||
|
digitalWrite(k, HIGH);
|
||||||
|
k --;
|
||||||
|
}
|
||||||
|
k = 9;
|
||||||
|
goto defuseSign;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
|
||||||
|
defuseSign:
|
||||||
|
lb = k + 2;
|
||||||
|
while ( lb > 2 ) {
|
||||||
|
digitalWrite(bell, HIGH);
|
||||||
|
digitalWrite(lb, LOW);
|
||||||
|
delay(500 - lb*25);
|
||||||
|
digitalWrite(bell, LOW);
|
||||||
|
delay(200 - lb*15);
|
||||||
|
lb --;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
BIN
yellow_prints.png
Normal file
BIN
yellow_prints.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 703 KiB |
Loading…
Reference in New Issue
Block a user