http://kocoafab.cc/tutorial/view/448
여기 예제를 보고 실험중입니다.
http://www.robotscience.kr/goods/view?no=5712#
위에서 구입한예제에 있는 것이랑 비슷한 LCD로 실험중인데
프로세싱 코드(비트맵 변환 코드)
를 프로세싱 에서 구동을 시켰는데 오류가 뜨네요..
------------------------------------------------------------------------------------------------------
// Convert image to a C header file suitable for the Adafruit_Thermal library.
// This is NOT an Arduino sketch. Runs in Processing IDE (www.processing.org)
void setup() {
// Select and load image
selectInput("Select image file to convert:", "processImage");
}
void processImage(File image) {
String filename, basename;
PImage img;
PrintWriter output;
int i, x, y, b, rowBytes, totalBytes, lastBit, sum, n;
println("Loading image...");
filename = image.getPath();
img = loadImage(image.getPath());
// Morph filename into output filename and base name for data
x = filename.lastIndexOf('.');
if(x > 0) filename = filename.substring(0, x); // Strip current extension
x = filename.lastIndexOf('/');
if(x > 0) basename = filename.substring(x + 1); // Strip path
else basename = filename;
filename += ".h"; // Append '.h' to output filename
println("Writing output to " + filename);
// Calculate output size
rowBytes = (img.width + 7) / 8;
totalBytes = rowBytes * img.height;
// Convert image to B&W, make pixels readable
img.filter(THRESHOLD);
img.loadPixels();
// Open header file for output (NOTE: WILL CLOBBER EXISTING .H FILE, if any)
output = createWriter(filename);
// Write image dimensions and beginning of array
output.println("#ifndef _" + basename + "_h_");
output.println("#define _" + basename + "_h_");
output.println();
output.println("#define " + basename + "_width " + img.width);
output.println("#define " + basename + "_height " + img.height);
output.println();
output.print("static PROGMEM prog_uchar " + basename + "_data[] = {");
// Generate body of array
for(i=n=y=0; y=lastBit; b >>= 1) { // Each pixel within block...
if((img.pixels[i++] & 1) == 0) sum |= b; // If black pixel, set bit
}
output.format("0xX", sum); // Write accumulated bits
if(++n < totalBytes) output.print(',');
}
}
// End array, close file, exit program
output.println();
output.println("};");
output.println();
output.println("#endif // _" + basename + "_h_");
output.flush();
output.close();
println("Done!");
exit();
}
-----------------------------------------------------------------------------------------------------------------
노란색으로 칠한 } 에 오류가 있어서 {로 바꾸니까
빨간색으로 칠한 for(i=n=y=0; y=lastBit; b >>= 1) { // Each pixel within block...
이부분에 cannot convert from int to boolean 라고 오류가 생기네요..
ㅠㅠㅠ 도움 부탁드립니다.
|