-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clear EEPROM and read recent results
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
arduino/v5.3/prime_Arduino_clear_EEPROM/prime_Arduino_clear_EEPROM.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Clear EEPROM for the 11x4 bytes where float time is stored | ||
|
||
#include <EEPROM.h> | ||
|
||
const uint32_t scope[] = {100, 1000, 10000, 100000, 1000000, 10000000, 25000000, 100000000, 1000000000, 2147483647, 4294967295}; | ||
const uint32_t number_primes[] = {25, 168, 1229, 9592, 78498, 664579, 1565927, 5761455, 50847534, 105097564, 203280221}; | ||
|
||
void setup(void) { | ||
for(int i = 0; i < 11; i++) { | ||
EEPROM.put(i * 4 + 1, 0.0); | ||
} | ||
} | ||
|
||
void loop(void) { | ||
} |
24 changes: 24 additions & 0 deletions
24
arduino/v5.3/prime_Arduino_read_EEPROM/prime_Arduino_read_EEPROM.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// read EEPROM for the 11x4 bytes where time is stored as float | ||
|
||
#include <EEPROM.h> | ||
|
||
const uint32_t scope[] = {100, 1000, 10000, 100000, 1000000, 10000000, 25000000, 100000000, 1000000000, 2147483647, 4294967295}; | ||
|
||
void setup(void) { | ||
Serial.begin(9600); | ||
Serial.print("\nGet previous results for this Arduino Uno:\n"); | ||
Serial.print(" last time \n"); | ||
for(int i = 0; i < 11; i++) { | ||
int spaces = 10 - (int)log10(scope[i]); | ||
for(int j = 0; j < spaces; j++) { Serial.print(" "); } | ||
Serial.print(scope[i]); | ||
Serial.print(" "); | ||
float last_time; | ||
EEPROM.get(i * 4 + 1, last_time); | ||
Serial.print(last_time, 6); | ||
Serial.print("\n"); | ||
} | ||
} | ||
|
||
void loop(void) { | ||
} |
25 changes: 25 additions & 0 deletions
25
arduino/v5.3/prime_Arduino_read_EEPROM_nice/prime_Arduino_read_EEPROM_nice.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// read EEPROM for the 11x4 bytes where time is stored as float | ||
|
||
#include <EEPROM.h> | ||
|
||
const uint32_t scope[] = {100, 1000, 10000, 100000, 1000000, 10000000, 25000000, 100000000, 1000000000, 2147483647, 4294967295}; | ||
const uint32_t nr_primes[] = {25, 168, 1229, 9592, 78498, 664579, 1565927, 5761455, 50847534, 105097564, 203280221}; | ||
const char* label[] = {"100", "1,000", "10,000", "100,000", "1,000,000", "10,000,000", "25,000,000", "100,000,000", "1,000,000,000", "2,147,483,647", "4,294,967,295"}; | ||
|
||
void setup(void) { | ||
Serial.begin(9600); | ||
Serial.print("\nGet previous results for this Arduino Uno:\n"); | ||
Serial.print(" calculated to time in seconds \n"); | ||
for(int i = 0; i < 11; i++) { | ||
int spaces = 14 - strlen(label[i]); | ||
for(int j = 0; j < spaces; j++) { Serial.print(" "); } | ||
Serial.print(label[i]); | ||
Serial.print(" "); | ||
float last_time_seconds; | ||
EEPROM.get(i * 4 + 1, last_time_seconds); | ||
Serial.println(last_time_seconds, 6); | ||
} | ||
} | ||
|
||
void loop(void) { | ||
} |