AMG8833处理未运行

发布于 2025-01-22 20:31:19 字数 3235 浏览 2 评论 0原文

我遵循了我从Chippiko获得的此处理代码的AMG8833热扫描仪,但是由于我可能错过的更正,该功能不会运行。我不是一个熟练的编码员,只有Arduino的C ++语言知识有限。请帮忙!

这是代码:

"Chip Piko Thermal Camera Non Interpolation"
"This code is editing from the amg8833 sparkfun library" 
 import processing.serial;

String (myString = null);
Serial myPort ;  
PFont f;
float split;
int q;

float[] show =  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0};
float[] temps =  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0};


  void setup() {
    size(600, 680);  
    f = createFont("Arial", 16, true);


 // Print a list of connected port in serial monitor processing
 printArray(Serial.list());

 //In this case, I using /dev/ttyUSB0 in linux
 //In serial monitor this processing show in array 32
 //If you windows user, please change Serial.list()[your number]
   myPort = new Serial(this, Serial.list()[32], 115200);
   myPort.clear();
   myString = myPort.readStringUntil(13);
   myString = null;
 // change to HSB color mode, this will make it easier to color
 // code the temperature data
 colorMode(HSB, 360, 100, 100);
 }


void draw() { 
  if (myPort.available() > 64) {
    myString = myPort.readStringUntil(13);

  if (myString != null) {
    String splitString[] = splitTokens(myString, ",");


  // Map a temperature from AMG8233
  for (q = 0; q < 64; q++) {
    split = (float(splitString[q]));
    show[q] = float(splitString[q]) ;

    //Map a Red color pixel 
    if (split >= 28.5) {
      temps[q] = map(float(splitString[q]), 28.5, 35, 30, 0);
    }

    //Map a Orange color pixel 
    if ((split >= 27.50) && (split <= 28.2)) {
      temps[q] = map(float(splitString[q]), 27.50, 28.2, 50, 30);
    }

    //Map a Blue color pixel 
    if (split <= 27.250) {
      temps[q] = map(float(splitString[q]), 20, 27.25, 240, 180);
    }

       println(split);
      }
    }
  }



  int x = 0;
  int y = 80;
  int i = 0;
    background(0);   // Clear the screen with a black background

 while (y < 630) {
   fill(0, 0, 0);
   rect(0, 0, 220, 80);
   textSize(40);
   fill(0, 0, 100); 
   text("CHIP PIKO", 15, 45);

   textSize(16);
   text("www.chippiko.com", 50, 65);

   fill(0, 0, 100);
   rect(225, 0, 600, 80);

   textAlign(LEFT, CENTER);
   textSize(16);
   fill(0, 0, 0); //HBS

  text("Thermal Camera Non Interpolation", 240, 11);
  line(220, 27, 600, 27);
  line(330, 27, 330, 55);
  line(460, 27, 460, 55); 
  text("Piksel : 8x8    Range : 0-80°C     Accuracy : ±2°C", 240, 39);

  line(220, 55, 600, 55);
  text("Labuhan Haji - Aceh , 8:57pm 2 November 2019", 240, 65);


  while (x < 550) {
    fill(temps[i], 100, 100);
    rect(x, y, 75, 75);

    //Show Temp Value
    textAlign(CENTER, CENTER);
    textFont(f, 11);
    fill(0);
    text((show[i]), (x+37.5), (y+37.5));

  //Show Pixel Digit
  textAlign(LEFT, LEFT);
  fill(100);
  text(i, (x+3), (y+12));

  x = x + 75;
  i++;
}

y = y + 75;
x = 0;
  }
}

开放建议和帮助!

I have followed this processing code I got from Chippiko for the AMG8833 thermal scanner but the function won't run because of corrections that I might have missed. I am not a skilled coder with only limited knowledge in C++ language with Arduino. Please help !

Here is the code:

"Chip Piko Thermal Camera Non Interpolation"
"This code is editing from the amg8833 sparkfun library" 
 import processing.serial;

String (myString = null);
Serial myPort ;  
PFont f;
float split;
int q;

float[] show =  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0};
float[] temps =  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0};


  void setup() {
    size(600, 680);  
    f = createFont("Arial", 16, true);


 // Print a list of connected port in serial monitor processing
 printArray(Serial.list());

 //In this case, I using /dev/ttyUSB0 in linux
 //In serial monitor this processing show in array 32
 //If you windows user, please change Serial.list()[your number]
   myPort = new Serial(this, Serial.list()[32], 115200);
   myPort.clear();
   myString = myPort.readStringUntil(13);
   myString = null;
 // change to HSB color mode, this will make it easier to color
 // code the temperature data
 colorMode(HSB, 360, 100, 100);
 }


void draw() { 
  if (myPort.available() > 64) {
    myString = myPort.readStringUntil(13);

  if (myString != null) {
    String splitString[] = splitTokens(myString, ",");


  // Map a temperature from AMG8233
  for (q = 0; q < 64; q++) {
    split = (float(splitString[q]));
    show[q] = float(splitString[q]) ;

    //Map a Red color pixel 
    if (split >= 28.5) {
      temps[q] = map(float(splitString[q]), 28.5, 35, 30, 0);
    }

    //Map a Orange color pixel 
    if ((split >= 27.50) && (split <= 28.2)) {
      temps[q] = map(float(splitString[q]), 27.50, 28.2, 50, 30);
    }

    //Map a Blue color pixel 
    if (split <= 27.250) {
      temps[q] = map(float(splitString[q]), 20, 27.25, 240, 180);
    }

       println(split);
      }
    }
  }



  int x = 0;
  int y = 80;
  int i = 0;
    background(0);   // Clear the screen with a black background

 while (y < 630) {
   fill(0, 0, 0);
   rect(0, 0, 220, 80);
   textSize(40);
   fill(0, 0, 100); 
   text("CHIP PIKO", 15, 45);

   textSize(16);
   text("www.chippiko.com", 50, 65);

   fill(0, 0, 100);
   rect(225, 0, 600, 80);

   textAlign(LEFT, CENTER);
   textSize(16);
   fill(0, 0, 0); //HBS

  text("Thermal Camera Non Interpolation", 240, 11);
  line(220, 27, 600, 27);
  line(330, 27, 330, 55);
  line(460, 27, 460, 55); 
  text("Piksel : 8x8    Range : 0-80°C     Accuracy : ±2°C", 240, 39);

  line(220, 55, 600, 55);
  text("Labuhan Haji - Aceh , 8:57pm 2 November 2019", 240, 65);


  while (x < 550) {
    fill(temps[i], 100, 100);
    rect(x, y, 75, 75);

    //Show Temp Value
    textAlign(CENTER, CENTER);
    textFont(f, 11);
    fill(0);
    text((show[i]), (x+37.5), (y+37.5));

  //Show Pixel Digit
  textAlign(LEFT, LEFT);
  fill(100);
  text(i, (x+3), (y+12));

  x = x + 75;
  i++;
}

y = y + 75;
x = 0;
  }
}

Open for suggestions and help !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文