forked from arduino-libraries/Arduino_SecureElement
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRandomNumber.ino
41 lines (30 loc) · 928 Bytes
/
RandomNumber.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
SecureElement Random Number
This sketch uses the ECC508/ECC608 or SE050 to generate a random number
every second and print it to the Serial Monitor
If the SecureElement is not configured and locked the ConfigurationLocking
example should be used before running this sketch to setup the chip with a
default TLS configuration.
Circuit:
- A board equipped with ECC508 or ECC608 or SE050 chip
This example code is in the public domain.
*/
#include <Arduino_SecureElement.h>
SecureElement secureElement;
void setup() {
Serial.begin(9600);
while (!Serial);
if (!secureElement.begin()) {
Serial.println("Failed to communicate with SecureElement!");
while (1);
}
if (!secureElement.locked()) {
Serial.println("The SecureElement is not locked!");
while (1);
}
}
void loop() {
Serial.print("Random number = ");
Serial.println(secureElement.random(65535));
delay(1000);
}