Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Bounce, fixed PROGMEM #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
._*
30 changes: 15 additions & 15 deletions sketch_06_07/sketch_06_07.pde
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
//sketch 06-07

#include <Bounce.h>
#include <Bounce2.h>

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);
}
}
77 changes: 38 additions & 39 deletions sketch_08_01/sketch_08_01.pde
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -109,4 +109,3 @@ void flashDotOrDash(char dotOrDash)
delay(dotDelay); // gap between flashes
}