Skip to content

Commit 69afabc

Browse files
committed
v1
1 parent 4cc272c commit 69afabc

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,6 @@ cython_debug/
169169

170170
# PyPI configuration file
171171
.pypirc
172+
.DS_Store
173+
.vscode
174+

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
11
# kernel-of-truth
2+
23
A MagTag quote board
4+
5+
![Demo Image](demo.png)
6+
7+
## Client Requirements
8+
9+
MagTag code is written in CircuitPython. The following libraries are required:
10+
11+
- Adafruit MagTag
12+
- Adafruit MagTag Libraries
13+
- adafruit_bitmap_font
14+
- adafruit_io
15+
- adafruit_magtag
16+
- adafruit_minimqtt
17+
- adafruit_requests
18+
- adafruit_ticks
19+
20+
## Usage
21+
22+
The MagTag display automatically updates every 24 hours with a new quote. Quotes are stored locally, so no network connectivity is required.

code.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import time
2+
from adafruit_magtag.magtag import MagTag
3+
import random
4+
5+
QUOTES = [
6+
"The more I study, the more insatiable do I feel my genius for it to be. - Ada Lovelace",
7+
"That brain of mine is something more than merely mortal; as time will show. - Ada Lovelace",
8+
"Programming is the art of algorithm design and the craft of debugging errant code. - Ellen Ullman",
9+
"The most damaging phrase in the language is: 'It's always been done that way.' - Grace Hopper",
10+
"An algorithm must be seen to be believed. - Donald Knuth",
11+
"Machines take me by surprise with great frequency. - Alan Turing",
12+
"The computer was born to solve problems that did not exist before. - Bill Gates",
13+
"The function of good software is to make the complex appear to be simple. - Grady Booch",
14+
"The best way to predict the future is to invent it. - Alan Kay",
15+
"A good programmer is someone who always looks both ways before crossing a one-way street. - Doug Linder",
16+
"The most important property of a program is whether it accomplishes the intention of its user. - C.A.R. Hoare",
17+
"The purpose of computing is insight, not numbers. - Richard Hamming",
18+
"The best thing about a boolean is even if you are wrong, you are only off by a bit. - Anonymous",
19+
"The computer is a moron. - Peter Drucker",
20+
"The computer is incredibly fast, accurate, and stupid. Man is unbelievably slow, inaccurate, and brilliant. The marriage of the two is a force beyond calculation. - Leo Cherne",
21+
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking",
22+
"The real problem is not whether machines think but whether men do. - B.F. Skinner",
23+
"The question of whether a computer can think is no more interesting than the question of whether a submarine can swim. - Edsger Dijkstra",
24+
"The computing scientist’s main challenge is not to get confused by the complexities of his own making. - Edsger Dijkstra",
25+
"The best performance improvement is the transition from the nonworking state to the working state. - John Ousterhout",
26+
"The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. - Seymour Cray",
27+
"The best programs are the ones written when the programmer is supposed to be working on something else. - Melinda Varian",
28+
"The best way to get a project done faster is to start sooner. - Jim Highsmith",
29+
"The best way to learn is to do. - Paul Halmos",
30+
"The best way to understand recursion is to begin by understanding recursion. - Anonymous",
31+
"The best way to predict the future is to create it. - Peter Drucker",
32+
"The best way to escape from a problem is to solve it. - Alan Saporta",
33+
"The best way to have a good idea is to have a lot of ideas. - Linus Pauling"
34+
]
35+
36+
magtag = MagTag()
37+
38+
magtag.add_text(
39+
text_wrap=40,
40+
text_position=(
41+
(magtag.graphics.display.width // 2),
42+
(magtag.graphics.display.height // 2),
43+
),
44+
line_spacing=1,
45+
text_anchor_point=(0.5, 0.5), # center the text on x & y
46+
text_scale=1,
47+
)
48+
49+
quote = random.choice(QUOTES)
50+
magtag.set_text(quote)
51+
52+
# wait 2 seconds for display to complete
53+
time.sleep(2)
54+
55+
# sleep to save battery
56+
magtag.exit_and_deep_sleep(86400)

demo.png

6.23 MB
Loading

0 commit comments

Comments
 (0)