The FastNoise library compiles as it is for the Arduino MKR and Arduino Zero, but there is a "not cool" issue for the Due: https://github.com/arduino/ArduinoCore-samd/issues/308
A issue with assert
can easily be solved, but the #include <algorithm>
and #include <random>
are somehow linked to a printf
function.
I thought it was very hard, but then @Juraj wrote in his answer about the simple solution to comment out the #undef printf
line.
In the file cstdio is a list of about fourty #undef
lines. Only the printf
requires to be commented out.
// #undef printf
The file is located in the hidden "Arduino15" folder in the build environment for the Due: Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\cstdio
Then it will also compile for the Arduino Due (even without removing the assert). There are many warnings.
I was able to run it on a SAMD21 processor and it produces random numbers. However, I am not sure that those numbers are correct. I don't know if the many compiler warnings can be ignored.
#include <FastNoise.h>
FastNoise myNoise; // Create a FastNoise object
float heightMap[32][32]; // 2D heightmap to create terrain
void setup() {
SerialUSB.begin(9600);
SerialUSB.println("FastNoise");
delay(1000);
myNoise.SetNoiseType(FastNoise::SimplexFractal); // Set the desired noise type
for(int x=0; x<32; x++) {
for(int y=0; y<32; y++) {
heightMap[x][y] = myNoise.GetNoise(x,y);
SerialUSB.println(heightMap[x][y]);
}
}
}
void loop() {
}
Do you know the XY Problem? You did not explain the reason for trying to make that library run on a Arduino Due. Perhaps there is an other way for what you want to achieve.
The Arduino Due was a major update for the Arduino boards, but nowadays some say to avoid the Arduino Due because it has issues (hardware and software).
I have updated my answer with help of the answer from @Juray.