Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - klebue

Pages: [1]
1
Calculator C / Re: crash after calling function twice
« on: May 26, 2010, 04:53:13 pm »
Thanks for the advice, the function thing is working now.
However, I still couldn't figure out how to quit a program and make the calculator continue working the old-fashioned way.

/edit:
problem solved, the last lines should be
Code: [Select]
while (!isKeyPressed(KEY_NSPIRE_ESC)) {
rand();
}
return 0;
The nspire doesn't like doing nothing ;)

2
Calculator C / crash after calling function twice
« on: May 24, 2010, 12:28:30 pm »
Hi there!
I'm trying to get into c programming for nspire (actually I'm trying to get into c programming at all ;) )

I can have a very simple function, say to draw a dot of 2*2 pixels.
The function works just fine and draws my dot, but when the function is called for a second time the nspire crashes.
Here is the code I use:
Code: [Select]
int main(void) {
clearScreen();

void drawdot(int posx, int posy, int colour) {
setPixel(posx, posy, colour);
setPixel(posx+1, posy, colour);
setPixel(posx, posy+1, colour);
setPixel(posx+1, posy+1, colour);
}

drawdot(10,10,0); //works fine
drawdot(10,15,0); //crashes when I add this line

while (!isKeyPressed(KEY_NSPIRE_ESC)) {}
return 0;
}

There is also another problem: When I press ESC the calculator will stop responding instead of redrawing the normal screen.
What am I missing to make him do so? I can't figure out what makes it work in other programs.

Thanks in advance!

3
In tutorial 2 you might want to give the right answer for computation 4 ;)
Apart from that I like you tutorials a lot!

Pages: [1]