thanks, this is what ive got
<<code>>
- include "mbed.h"
- include "N5110.h"
Dan Tomlinson 26/03/14
vcc, sce, rst, dc, mosi, clk, led
N5110 lcd(p5,p6,p7,p8,p11,p13,p21); PWM for backlight
global variable
set functions
void checkerBoard();
void clearCells();
void getPixels();
void getPixels(int i, int j){checks quantity of neighbours
int n=0;
if (lcd.getPixel(i-1,j-1))pixel to top-left
n++;
if (lcd.getPixel(i-1,j))pixel to left
n++;
if (lcd.getPixel(i-1,j+1))pixel to bottom-left
n++;
if (lcd.getPixel(i,j-1))pixel to top
n++;
if (lcd.getPixel(i,j+1))pixel to bottom
n++;
if (lcd.getPixel(i+1,j-1))pixel to top-right
n++;
if (lcd.getPixel(i+1,j))pixel to right
n++;
if (lcd.getPixel(i+1,j+1))pixel to bottom-right
n++;
return n;
}
clears cells
void clearCells(){ loop through cells and clear
for (int i=0; i<84; i++){
for (int j=0; j< 48; j++) {
lcd.clearPixel(i,j);
}
}
}
set pixels
void checkerBoard(){ set pixels
for (int i = 0; i < 84 ; i+=7) { pixel axis and plots in increments of 7
for (int j = 0; j < 48 ; j+=4) { increments of 4
lcd.setPixel(i,j);
}
}
lcd.refresh(); must refresh to write buffer display
}
int main(){
lcd.init(); initialise display
lcd.printString("Welcome To",15,1); display splash screen through 'x,y' pixel co-ordinates
lcd.printString("Conway's",20,2);
lcd.printString("Game Of life",6,3);
lcd.printString("Dan Tomlinson",0,5);
wait(4.0);
while(1) {
checkerBoard();set pixels
getPixels();
}
}
<</code>>
I know that the code for searching for pixels needs an extra loop so it is able to do something with the return type but i dont know if that means my code still shouldnt be compiling at this point?
Hi guys,
New to C++, currently trying to tackle the Game of life. I've managed to initialise the screen and bring up some pixels. Im now trying to right a function that will detect pixels neighbours before I can move on to functions that will make the pixels "evolve". I've set 'n=0' and asked for return of 'n' after checking for pixels but it keeps saying
Error: Undefined symbol getPixels() (referred from Lifec.cpp.LPC1768.o).