Skip to content

Commit

Permalink
LED works with PC13
Browse files Browse the repository at this point in the history
  • Loading branch information
kreier committed Dec 18, 2023
1 parent 5fc941d commit 6cab934
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions arduino/v5.3/prime_logging_stm32f411/prime_logging_stm32f411.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ double start;
int column = 10;
int found = 4; // we already know 2, 3, 5, 7
int divisors = found;
uint32_t primes[6550] = {3, 5, 7};
int led = 13; // LED_BUILTIN

uint32_t primes[3550] = {3, 5, 7};
int led = PC13; // LED_BUILTIN

int is_prime(uint32_t number) {
int prime = 1;
Expand Down Expand Up @@ -70,6 +69,7 @@ void elapsed_time(int seconds) {
void setup() {
Serial.begin(74880);
pinMode(led, OUTPUT);
digitalWrite(led,LOW);
for (int i = 0; i < 3; i++) {
Serial.print(".");
delay(1000);
Expand Down Expand Up @@ -101,8 +101,8 @@ void setup() {
Serial.println("\n\nPrime v5.4 in Arduino C - 2023/12/16");
Serial.print("Calculating prime numbers until ");
Serial.println(last);
// start = millis();
start = micros(); // use micros() for more precision in runtimes < 70 minutes
start = millis();
// start = micros(); // use micros() for more precision in runtimes < 70 minutes
int largest_divider = (int)(sqrt(last));
if(largest_divider % 2 == 0)
{
Expand Down Expand Up @@ -141,8 +141,8 @@ void setup() {
}
}
}
// float duration = (millis() - start)/1000;
float duration = (micros() - start)/1000000; // use micros() for more precision in runtimes < 70 minutes
float duration = (millis() - start)/1000;
// float duration = (micros() - start)/1000000; // use micros() for more precision in runtimes < 70 minutes
if(duration > 2) {
Serial.print("\n");
}
Expand Down
6 changes: 3 additions & 3 deletions arduino/v5.3/results_stm32f411.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Calculating prime numbers in Arduino C v5.4.2023
2023/12/16
Calculating prime numbers in Arduino C v5.4.2024
2023/12/17
STM32F411CEU6 with 100 MHz

last time in seconds
100 0.000644
100 0.000642
1,000 0.006408
10,000 0.066512
100,000 0.722038
Expand Down

0 comments on commit 6cab934

Please sign in to comment.