We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I´m working on my first sketch, and I have to do some extensive calculation in it. So I wrote only the calculation with a clock to know how long this will take. The error I get for all the variables is that they do not exist. What am I doing wrong?
void setup() {
widht = 80;
heght = 40;
zoomx1 = int(widht / 4);
zoomx2 = 2;
zoomy1 = int(heght / 4);
zoomy2 = 2;
noLoop();
int m = millis();
}
void draw() {
for (int i = 0; i < widht; i = i+1) {
x = i / zoomx1 - zoomx2;
for (int j = 0; j < heght; j = j+1) {
y = zoomy2 - j / zoomy1;
zr = 0;
zi = 0;
zr2 = 0;
zi2 = 0;
cr = x;
ci = y;
n = 1;
int i = 0;
while (n < 200 && (zr2 + zi2) < 4) {
zr2 = zr * zr;
zi2 = zi * zi;
zi = 2 * zi * zr + ci;
zr = zr2 - zi2 + cr;
n++;
}
}
}
int t = millis() - m;
print(t);
}
Thanks in advance,
Noel
Answers
http://www.TutorialsPoint.com/java/java_variable_types.htm
Ohh, I see, processing wants you to declare all variables There isn´t a default, like you had in VB6, the "variant". It´s a pity that they didn´t use a default like int. So I made all vars global, and don´t get any error but when I run the sketch it doesn't print anything to the console. Why?
@ line #28,
i = 0;
makesfor (int i = 0; i < wdht; i = i+1) {
infinite! :-&Thank you for all your kind answers!