Created
May 2, 2015 12:21
-
-
Save anonymous/c1fefbe2a3cc472dca92 to your computer and use it in GitHub Desktop.
Simple Benchmark for Arduino 16-bit addition
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
long millis_old = 0; | |
long millis_now =0; | |
int x=1; | |
int y=2; | |
int z=3; | |
int angle; | |
long sum = 0; | |
int m[750]; // a 1500 byte array | |
void setup() | |
{ | |
Serial.begin(115200); | |
for(int i = 0; i <=750; i++) | |
{ | |
m[i] = random(0,65535); | |
} | |
for(int i = 0; i <=31; i++) | |
{ | |
Serial.println(m[i]); | |
} | |
delay(5000); | |
} | |
void loop() | |
{ | |
millis_old = micros(); | |
//Serial.println(millis_old); | |
{ | |
for (int i = 1; i <=500; i++) | |
{ | |
// x = sin(i) * 100; | |
// y = /os(i) * 100; | |
// z = tan(i) * 100; | |
m[500-i] = (m[i] + m[500-i]); // add two memory locations | |
// Serial.println(sum); | |
} | |
millis_now = micros(); | |
Serial.println(millis_now - millis_old); | |
Serial.print("sum ="); | |
Serial.println(sum); | |
sum = 0; | |
} | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment