Skip to content

Commit 44baa6c

Browse files
committed
Add example
1 parent cab288c commit 44baa6c

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

examples/ESP32EduKit/ESP32EduKit.ino

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
ECCX08 Random Number running on an M5Stack Core2 ESP32 IoT EduKit
3+
4+
This sketch uses the ECC508 or ECC608 to generate a random number
5+
every second and print it to the Serial monitor
6+
7+
Circuit:
8+
- M5Stack Core2 ESP32 IoT EduKit
9+
10+
*/
11+
#include <ArduinoECCX08.h>
12+
13+
void setup() {
14+
Serial.begin(115200); Serial.println();
15+
16+
// The M5STack IoT EduKit has the ATECECCX08 at I2C address 0x35 and SDA 21, SCL 22.
17+
Wire.begin(21,22);
18+
if (!ECCX08.begin(0x35)) {
19+
Serial.println("Failed to communicate with ECC508/ECC608!");
20+
while (1);
21+
}
22+
23+
if (!ECCX08.locked()) {
24+
Serial.println("The ECC508/ECC608 is not locked!");
25+
while (1);
26+
}
27+
}
28+
29+
void loop() {
30+
Serial.print("Random number = ");
31+
Serial.println(ECCX08.random(65535));
32+
33+
delay(1000);
34+
}
35+

src/ECCX08.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#include <Arduino.h>
2424
#include <Wire.h>
2525

26-
#ifndef CONFIG_ARDUINO_ECCX08_I2C_ADDR
27-
#define CONFIG_ARDUINO_ECCX08_I2C_ADDR 0x60
28-
#endif
29-
3026
class ECCX08Class
3127
{
3228
public:

0 commit comments

Comments
 (0)