Hi,
I am playing around with my Teensy 3.6, which I received today!
Here is the code in question:
I wanted to see the FPU running fast...so I wrote this program which
calculates prime numbers and print them if one is found. It is a very simple program -
nothing compared to "The great Mersenne prime search" or such
The program runs ... and stops at 7949...at least this is the last number which is
visible with the serial monitor.
I replaced the "," with a "\n"...but the same happens...the output or the program got
stuck around ~7800...~7950.
But I cant find the reason for this...
How can I prevent the stop of the loop?
Another thing:
When uploading the code, the Arduino IDE prints:
"An error occurred while uploading the sketch"
then the uploader pops up briefly and the sketch will be flashed...
How can I fix that?
Environment:
GENTOO Linux (updated on a daily basis)
UDEV rules are installed
Arduino IDE 1.8.9
Standard USB (not 3.0).
Thanks a lot for any help in advance!
Cheers!
Meino
I am playing around with my Teensy 3.6, which I received today!
Here is the code in question:
Code:
#include <math.h>
// set this to the hardware serial port you wish to use
#define HWSERIAL Serial1
double num=3;
double divi=2;
void setup() {
Serial.begin(115200);
HWSERIAL.begin(115200);
}
// the loop routine runs over and over again forever:
void loop() {
double lim=sqrt(num);
int flg=0;
divi=2;
while( divi < lim ) {
if( 0.0 != fmod( num , divi )) {
divi += 1.0;
continue;
}
flg=1;
break;
}
if( ! (flg != 0.0) ) {
Serial.print( num );
Serial.print( "," );
}
num += 1.0;
}
I wanted to see the FPU running fast...so I wrote this program which
calculates prime numbers and print them if one is found. It is a very simple program -
nothing compared to "The great Mersenne prime search" or such
The program runs ... and stops at 7949...at least this is the last number which is
visible with the serial monitor.
I replaced the "," with a "\n"...but the same happens...the output or the program got
stuck around ~7800...~7950.
But I cant find the reason for this...
How can I prevent the stop of the loop?
Another thing:
When uploading the code, the Arduino IDE prints:
"An error occurred while uploading the sketch"
then the uploader pops up briefly and the sketch will be flashed...
How can I fix that?
Environment:
GENTOO Linux (updated on a daily basis)
UDEV rules are installed
Arduino IDE 1.8.9
Standard USB (not 3.0).
Thanks a lot for any help in advance!
Cheers!
Meino