Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 8 months ago.
the code didn't work as planned
the code should clear the pixel when the condition is not equal to 0, but it didn't give that output.
- include "mbed.h"
- include "N5110.h" int screen(int i,int j); N5110 lcd(p7,p8,p9,p10,p11,p13,p21); int main() { lcd.init(); lcd.setPixel(3,3); lcd.setPixel(2,3); lcd.setPixel(4,3); lcd.setPixel(3,4); lcd.setPixel(3,5); lcd.setPixel(3,6); lcd.setPixel(3,7); lcd.setPixel(4,4); lcd.setPixel(5,3); lcd.setPixel(4,2); lcd.setPixel(4,7); lcd.setPixel(5,6); lcd.setPixel(7,4); lcd.setPixel(1,4); lcd.setPixel(2,4); lcd.refresh(); while(1); { for (int i=0; i<84; i++) { for(int j=0; j<48; j++) {
int ky=0; if (lcd.getPixel(i,j)!=0) { ky=1; lcd.clearPixel(i,j); lcd.refresh(); } else if (lcd.getPixel(i,j)==0) { ky=0; lcd.setPixel(i,j); lcd.refresh(); } return ky;
} } } }
1 Answer
9 years, 8 months ago.
Taking a quick glance at that code it seems you're stuck in a while loop. The semicolon after your while (1) will put you in a permanent loop preventing you from ever reaching the for-loops & your clearing logic.
while(1); {