[Dprglist] Arduino Code Troubles

markus markus at bibi.ca
Thu Dec 16 17:43:25 PST 2021


isn't that what it's supposed to do?

if (268 > 200) {
  cm[3]  = 999;
}



On Thu, 16 Dec 2021 20:27:46 -0500
Pat Caron via DPRGlist <dprglist at lists.dprg.org> wrote:

> Hi guys, I'm looking for help with the following Arduino code.
> 
>     uint32_t cm[8] = {0,0,0,0,0,0,0,0}; // Create array
>     uint16_t maxDistance = 200; // Also used with NewPing.h library
>     .
>     . // Other code here
>     .
>     irSensorL.read(); // Read IR sensor... This is working!
>     cm[3] = irSensorL.ranging_data.range_mm/10; // This returns 268
>     if (cm[3] > maxDistance) {
>       cm[3] = 999;                 /
>     }
>     Serial.println(cm[3]);  / cm[3] value is always = 999
>     sendData();
> 
> The cm[3] value is always 999 when I run this.
> If I comment out the if cm[3]... statement cm[3] value is then 268.
> 
> ...Pat C



More information about the DPRGlist mailing list