diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72f1563 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +._* \ No newline at end of file diff --git a/sketch_06_07/sketch_06_07.pde b/sketch_06_07/sketch_06_07.pde index 39d3fc6..929daa3 100644 --- a/sketch_06_07/sketch_06_07.pde +++ b/sketch_06_07/sketch_06_07.pde @@ -1,26 +1,26 @@ //sketch 06-07 -#include +#include int inputPin = 5; int ledPin = 13; int ledValue = LOW; -Bounce bouncer = Bounce(inputPin, 5); +Bounce bouncer = Bounce(); -void setup() -{ - pinMode(inputPin, INPUT); - digitalWrite(inputPin, HIGH); - pinMode(ledPin, OUTPUT); -} +void setup() { + pinMode(ledPin, OUTPUT); -void loop() -{ - if (bouncer.update() && bouncer.read() == LOW) - { - ledValue = ! ledValue; - digitalWrite(ledPin, ledValue); - } + pinMode(inputPin, INPUT); + digitalWrite(inputPin, HIGH); + + bouncer.attach(inputPin); + bouncer.interval(5); } +void loop() { + if (bouncer.update() && bouncer.read() == LOW) { + ledValue = ! ledValue; + digitalWrite(ledPin, ledValue); + } +} diff --git a/sketch_08_01/sketch_08_01.pde b/sketch_08_01/sketch_08_01.pde index 8daf31c..aa13cef 100644 --- a/sketch_08_01/sketch_08_01.pde +++ b/sketch_08_01/sketch_08_01.pde @@ -3,49 +3,49 @@ int ledPin = 13; int dotDelay = 200; -PROGMEM prog_char sA[] = ".-"; -PROGMEM prog_char sB[] = "-..."; -PROGMEM prog_char sC[] = "-.-."; -PROGMEM prog_char sD[] = "-.."; -PROGMEM prog_char sE[] = "."; -PROGMEM prog_char sF[] = "..-."; -PROGMEM prog_char sG[] = "--."; -PROGMEM prog_char sH[] = "...."; -PROGMEM prog_char sI[] = ".."; -PROGMEM prog_char sJ[] = ".---"; -PROGMEM prog_char sK[] = "-.-"; -PROGMEM prog_char sL[] = ".-.."; -PROGMEM prog_char sM[] = "--"; -PROGMEM prog_char sN[] = "-."; -PROGMEM prog_char sO[] = "---"; -PROGMEM prog_char sP[] = ".--."; -PROGMEM prog_char sQ[] = "--.-"; -PROGMEM prog_char sR[] = ".-."; -PROGMEM prog_char sS[] = "..."; -PROGMEM prog_char sT[] = "-"; -PROGMEM prog_char sU[] = "..-"; -PROGMEM prog_char sV[] = "...-"; -PROGMEM prog_char sW[] = ".--"; -PROGMEM prog_char sX[] = "-..-"; -PROGMEM prog_char sY[] = "-.--"; -PROGMEM prog_char sZ[] = "--.."; +const PROGMEM char sA[] = ".-"; +const PROGMEM char sB[] = "-..."; +const PROGMEM char sC[] = "-.-."; +const PROGMEM char sD[] = "-.."; +const PROGMEM char sE[] = "."; +const PROGMEM char sF[] = "..-."; +const PROGMEM char sG[] = "--."; +const PROGMEM char sH[] = "...."; +const PROGMEM char sI[] = ".."; +const PROGMEM char sJ[] = ".---"; +const PROGMEM char sK[] = "-.-"; +const PROGMEM char sL[] = ".-.."; +const PROGMEM char sM[] = "--"; +const PROGMEM char sN[] = "-."; +const PROGMEM char sO[] = "---"; +const PROGMEM char sP[] = ".--."; +const PROGMEM char sQ[] = "--.-"; +const PROGMEM char sR[] = ".-."; +const PROGMEM char sS[] = "..."; +const PROGMEM char sT[] = "-"; +const PROGMEM char sU[] = "..-"; +const PROGMEM char sV[] = "...-"; +const PROGMEM char sW[] = ".--"; +const PROGMEM char sX[] = "-..-"; +const PROGMEM char sY[] = "-.--"; +const PROGMEM char sZ[] = "--.."; -PROGMEM const char* letters[] = {sA, sB, sC, sD, sE, sF, sG, sH, sI, sJ, sK, sL, sM, +const PROGMEM char* const letters[] = {sA, sB, sC, sD, sE, sF, sG, sH, sI, sJ, sK, sL, sM, sN, sO, sP, sQ, sR, sS, sT, sU, sV, sW, sX, sY, sZ}; -PROGMEM prog_char s0[] = "-----"; -PROGMEM prog_char s1[] = ".----"; -PROGMEM prog_char s2[] = "..---"; -PROGMEM prog_char s3[] = "...--"; -PROGMEM prog_char s4[] = "....-"; -PROGMEM prog_char s5[] = "....."; -PROGMEM prog_char s6[] = "-...."; -PROGMEM prog_char s7[] = "--..."; -PROGMEM prog_char s8[] = "---.."; -PROGMEM prog_char s9[] = "----."; +const PROGMEM char s0[] = "-----"; +const PROGMEM char s1[] = ".----"; +const PROGMEM char s2[] = "..---"; +const PROGMEM char s3[] = "...--"; +const PROGMEM char s4[] = "....-"; +const PROGMEM char s5[] = "....."; +const PROGMEM char s6[] = "-...."; +const PROGMEM char s7[] = "--..."; +const PROGMEM char s8[] = "---.."; +const PROGMEM char s9[] = "----."; -PROGMEM const char* numbers[] = {s0, s1, s2, s3, s4, s5, s6, s7, s8, s9}; +const PROGMEM char* const numbers[] = {s0, s1, s2, s3, s4, s5, s6, s7, s8, s9}; char buffer[6]; @@ -109,4 +109,3 @@ void flashDotOrDash(char dotOrDash) delay(dotDelay); // gap between flashes } -