# HeatCam examples .... Please help!

**URL:** <https://discourse.processing.org/t/heatcam-examples-please-help/29390>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [April 15, 2021, 7:32pm UTC](https://discourse.processing.org/t/heatcam-examples-please-help/29390 "2021-04-15T19:32:29Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [April 15, 2021, 9:53pm UTC](https://discourse.processing.org/t/heatcam-examples-please-help/29390/4 "2021-04-15T21:53:03Z")

</div>

Hello,

This was just a _quick look at this_ !  
I have a lot of experience getting examples working. `:)`

Try this:

> **Arduino Code**
>
> ```auto
> void setup() 
> {
> Serial.begin(115200);
> }
> 
> void loop() 
> {
> // Print the temperature value of each pixel in floating point degrees Celsius
> // separated by commas
> 
> float temp = 10.00; 
> for(unsigned char i = 0; i < 64; i++)
> { 
> //Serial.print(grideye.getPixelTemperature(i));
> Serial.print(temp, 2);
> Serial.print(",");
> temp += 0.25; 
> } 
> 
> // End each frame with a linefeed
> Serial.println();
> 
> // Give Processing time to chew
> delay(100);
> }
> 
> ```

> **Processing Code**
>
> ```auto
> if(myPort.available() > 64)
> {
> myString = myPort.readStringUntil(13);
>   
> // generate an array of strings that contains each of the comma
> // separated values
> //println(myString);
>     
> if (myString != null)  
> {
> trim(myString);  
> String splitString[] = splitTokens(myString, ",");
> //printArray(splitString);
> if (splitString.length == 65) //65 for that last bit of data after the last ',' !
> {
> // for each of the 64 values, map the temperatures between 20C and 40C
> // to the blue through red portion of the color space
> for(int q = 0; q < 64; q++)
> {
> temps[q] = map(float(splitString[q]), 20, 40, 240, 360);
> }
> //printArray(temps);
> }  
> }
> }
> 
> ```

Please take a close look at what I did.  
I added a lot of checks!  
I used trim to remove the linefeed (goes along for the ride from println()) before splitting it.  
I added a lot of print statements to see what was being received; uncomment these to understand this.  
The data length of spitString array is actually 65 because there is an empty string after the last ‘,’

Reference:  
_[SparkFun\_GridEYE\_Arduino\_Library/examples/Example4-ProcessingHeatCam at master · sparkfun/SparkFun\_GridEYE\_Arduino\_Library · GitHub](https://github.com/sparkfun/SparkFun_GridEYE_Arduino_Library/tree/master/examples/Example4-ProcessingHeatCam)_

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f4d46b15d45ca52aafe9e4eb238e4f944d0e5d14.png)

That is a lot of zeroes!

```auto
//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};
float[] temps = new float [64];
printArray(temps);

```

`:)`

---

_[View the full topic](https://discourse.processing.org/t/heatcam-examples-please-help/29390)._
