Create entropy test sketch for random ids
This commit is contained in:
parent
5b4ffba112
commit
5f6c5633e6
6 changed files with 49 additions and 0 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
||||||
[submodule "lantern-build-engine"]
|
[submodule "lantern-build-engine"]
|
||||||
path = lantern-build-engine
|
path = lantern-build-engine
|
||||||
url = https://gitlab.com/sbrl/lantern-build-engine.git
|
url = https://gitlab.com/sbrl/lantern-build-engine.git
|
||||||
|
[submodule "iot/libraries/Entropy"]
|
||||||
|
path = iot/libraries/Entropy
|
||||||
|
url = https://github.com/taoyuan/Entropy.git
|
||||||
|
|
|
@ -14,3 +14,7 @@
|
||||||
- [Battery](https://smile.amazon.co.uk/Anker-PowerCore-Aluminum-Portable-Lipstick-Sized-Black/dp/B005QI1A8C/) - Size currently unknown - I'll need to run some tests to see how much power it uses to figure out the right battery size.
|
- [Battery](https://smile.amazon.co.uk/Anker-PowerCore-Aluminum-Portable-Lipstick-Sized-Black/dp/B005QI1A8C/) - Size currently unknown - I'll need to run some tests to see how much power it uses to figure out the right battery size.
|
||||||
- [Project box](https://smile.amazon.co.uk/waterproof-plastic-Enclosure-Power-junction-Grey/dp/B01JHBHNMA/) - if we can't 3D print one
|
- [Project box](https://smile.amazon.co.uk/waterproof-plastic-Enclosure-Power-junction-Grey/dp/B01JHBHNMA/) - if we can't 3D print one
|
||||||
- [TPL-5111](https://www.adafruit.com/product/3573) - also available from Pimoroni
|
- [TPL-5111](https://www.adafruit.com/product/3573) - also available from Pimoroni
|
||||||
|
|
||||||
|
|
||||||
|
## Useful Links
|
||||||
|
- Entropy extraction from the watchdog timer vs the internal clock: https://github.com/taoyuan/Entropy
|
||||||
|
|
1
iot/EntropyTest/Entropy.cpp
Symbolic link
1
iot/EntropyTest/Entropy.cpp
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../libraries/Entropy/Entropy.cpp
|
1
iot/EntropyTest/Entropy.h
Symbolic link
1
iot/EntropyTest/Entropy.h
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../libraries/Entropy/Entropy.h
|
39
iot/EntropyTest/EntropyTest.ino
Normal file
39
iot/EntropyTest/EntropyTest.ino
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Generate_Random_Numbers - This sketch makes use of the Entropy library
|
||||||
|
// to produce a sequence of random integers and floating point values.
|
||||||
|
// to demonstrate the use of the entropy library
|
||||||
|
//
|
||||||
|
// Copyright 2012 by Walter Anderson
|
||||||
|
//
|
||||||
|
// This file is part of Entropy, an Arduino library.
|
||||||
|
// Entropy 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.
|
||||||
|
//
|
||||||
|
// Entropy 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 Entropy. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// Edited by Starbeamrainbowlabs 2019
|
||||||
|
|
||||||
|
#include "Entropy.h"
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// This routine sets up the watch dog timer with interrupt handler to maintain a
|
||||||
|
// pool of real entropy for use in sketches. This mechanism is relatively slow
|
||||||
|
// since it will only produce a little less than two 32-bit random values per
|
||||||
|
// second.
|
||||||
|
Entropy.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
uint32_t random_long;
|
||||||
|
random_long = Entropy.random();
|
||||||
|
Serial.println(random_long);
|
||||||
|
}
|
1
iot/libraries/Entropy
Submodule
1
iot/libraries/Entropy
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 807c45cfe3e48422559b2aed5bc7de28df15ab3d
|
Loading…
Reference in a new issue