avatar

octotod

Member Since: November 2, 2006

Country: United States

  • I may have found a very strange bug: printing the result of modding a large number (over 10,000,000) with 1000 concatenated with a string seems to crash the microcontroller. If the number is concatenated with a char, no problem. I don't see this error on a Leonardo, which also uses the 32u4, so it may be a problem with the board definition for the Fio v3. This one was pretty annoying for me, so I hope this helps someone in a similar situation! Here is the code I use to replicate the bug:

    uint32_t counter = 9996000L;
    const uint8_t millisBtwUpdates = 100;
    
    uint32_t lastWriteTime = 0;
    
    void setup() {
      Serial.begin(115200);
    }
    
    void loop() {
      if((counter - lastWriteTime) > millisBtwUpdates) {
        int msecs = counter % 1000L;
    
        Serial.println(String(counter)+", "+String(msecs));  // causes crash
        //Serial.println(String(counter)+','+String(msecs));  // does not cause crash
        //Serial.println(String(counter)+","+String(msecs));  // does not cause crash
    
        /*
        // does not cause crash:
        Serial.print(String(counter));
        Serial.print(',');
        Serial.print(msecs);
        Serial.print(',');
        Serial.println(String(msecs));
        Serial.print('\n');
        */
    
        lastWriteTime = counter;
      }
      ++counter;
      delay(1);
    }
    
  • Are the "serial" (I2C) pins DCLK and DIN 5v tolerant?

    Also, can you use DCLK and DIN at the same time as the pins for Play, Next, etc? Seems like you can, given the diagram on page 2 of the datasheet.

No public wish lists :(