0

Adafruit Playground Classic Demo example won't compile
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Playground Classic Demo example won't compile

by youngr on Tue Sep 11, 2018 7:41 pm

I was just working through lesson 0. Got the blink program to work. But when I went to compile the demo program, I got the following compiling error. I have no idea what to do next. My computer is Windows 10.

Arduino: 1.8.6 (Windows 10), Board: "Adafruit Circuit Playground"

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\utility\talkie.cpp:15:73: error: narrowing conversion of '33472u' from 'unsigned int' to 'int16_t {aka int}' inside { } [-Wnarrowing]

0x1440,0x2740,0x38C0,0x47C0,0x5480,0x5EC0,0x6700,0x6D40},

.... followed by another 100 (didn't actually count these) or so of similar comments about narrowing conversion issues and ending with the following ....

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\utility\Adafruit_CPlay_NeoPixel.cpp:726:68: error: narrowing conversion of '2.555e+2' from 'double' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

exit status 1
Error compiling for board Adafruit Circuit Playground.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

youngr
 
Posts: 2
Joined: Tue Sep 11, 2018 7:38 pm

Re: Adafruit Playground Classic Demo example won't compile

by adafruit_support_mike on Thu Sep 13, 2018 2:34 am

Oh lovely, it looks like the Arduino IDE has changed its type conversion rules again.

That happens periodically.. the collection of support functions for the Arduino programming environment is complex, and sometimes they have to tweak the rules to make the compiler associate variables with the right types. Existing code tends to break every time that happens though.

In this case, the compiler is identifying values like '0x82C0' as unsigned 16-bit integers, but then freaking out because the code identifies them as regular 16-bit integers.

The easiest solution is to drop back to an older version of the IDE and try compiling the code there. If you don't want to do that, you can open the file Arduino\libraries\Adafruit_Circuit_Playground\utility\talkie.cpp and change lines like this one:

Code: Select all | TOGGLE FULL SIZE
static const int16_t PROGMEM
like this:

Code: Select all | TOGGLE FULL SIZE
static const uint16_t PROGMEM
Adding a 'u' to the start of the type name makes the array explicitly a collection of unsigned ints. Hopefully that won't break any other parts of the code that have to treat the values as regular integers.

adafruit_support_mike
 
Posts: 52594
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit Playground Classic Demo example won't compile

by youngr on Thu Sep 13, 2018 2:58 pm

So I started by finding the talkie.cpp file and replacing the code as suggested only to get a message that the file was not available for writing. So I couldn't save the changes.

At that point, I decided to follow your first suggestion and download an older version of the Arduino IDE only to discover that it had gone up to version 1.8.7 and one of the changes was .....

Treat "narrowing conversion" as warning, not error. This will make some libraries to compile again. Thanks @PaulStoffregen

So it now verified/compiled and uploaded. Yay!

Thanks for the helpful explanations. Hopefully my next few steps won't be as frustrating.

youngr
 
Posts: 2
Joined: Tue Sep 11, 2018 7:38 pm

Re: Adafruit Playground Classic Demo example won't compile

by adafruit_support_mike on Fri Sep 14, 2018 1:28 am

Ah.. Paul came to the rescue again.

He's the owner/developer of the Teensy platform, and one of the genuine uber-geeks. He's written an enormous amount of useful code, and given tons of good feedback to our own libraries as well as to the Arduino project.

youngr wrote:Thanks for the helpful explanations. Hopefully my next few steps won't be as frustrating.

If you're doing anything interesting, frustration is part of the game. One of the most valuable Maker skills is simply to keep banging your head against the wall after most people would give up.

The rush of seeing something hard actually work for the first time pays for the effort of getting there. Even something as simple as hooking up an LED and watching it blink is a joy that never gets old.

If you keep making stuff long enough, the emotional trajectory of a project starts to look familiar. Knowing the bad parts are coming makes it easier to get through them. Even the celebrity-level Makers feel that way. Adam Savage, who built models for the Star Wars movies and was in Mythbusters, talks about it well:

https://www.youtube.com/watch?v=X-UWkbx ... nel=Tested
https://www.youtube.com/watch?v=9okIF3R ... nel=Tested

adafruit_support_mike
 
Posts: 52594
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.