Author Options:

error code when verifying ColorCrossFadeRGBLED sketch / part 2 ? Answered

Thank you for responding but unfortunately it still wont work. I'm not very computer literate so when I try down loading the codes the file it sends it to puts it all on one line and even when I go thru it and separate every line it will compile but web editor don't recognize the file so it don't upload to my project. I print out the code and manually type it in. this is the section you are referring to and I cant find a problem there. (from the one I manually typed)

void crossFade(int color[3]) {
// Convert to 0-255
int R = (color[0] * 255) / 100;
int G = (color[1] * 255) / 100;
int B = (color[2] * 255) / 100;

int stepR = calculateStep(prevR, R);
int stepG = calculateStep(prevG, G);
int StepB = calculateStep(prevB, B); THIS IS LINE 191 ON MY CODE...

for (int i = 0; i <= 1020; i++) {
redVal = calculateVal(stepR, redVal, i);
grnVal = calculateVal(stepG, grnVal, i);
bluVal = calculateVal(stepB, bluVal, i); THIS IS LINE 196 IT IS THE LINE THAT GETS HIGH



'stepB' was not declared in this scope

arduino-builder/arduino-builder -compile -core-api-version 10611 -build-path /tmp/646225870 -hardware arduino-builder/hardware -hardware arduino-builder/packages/cores -tools arduino-builder/tools -tools arduino-builder/packages/tools -built-in-libraries arduino-builder/latest -libraries /tmp/076804971/pinned -libraries /tmp/076804971/custom -fqbn arduino:avr:uno -build-cache /tmp -verbose=false /tmp/076804971/ColorCrossFadingRGBLED

/tmp/076804971/ColorCrossFadingRGBLED/ColorCrossFadingRGBLED.ino: In function 'void crossFade(int*)':

/tmp/076804971/ColorCrossFadingRGBLED/ColorCrossFadingRGBLED.ino:196:27: error: 'stepB' was not declared in this scope

bluVal = calculateVal(stepB, bluVal, i);


exit status 1

1 Replies

bekathwiaBest Answer (author)2017-04-11

Learning to troubleshoot your hand-typed code is valuable skill that takes a lot of time to cultivate. You should be proud of yourself for trying and keep up with the great attitude whenever you get stuck. I have located the issue, it's a simple capitalization problem in your variable declaration: StepB should be stepB. I made the change and then the code compiled successfully!

Sorry about the single-line issue, some people have better luck downloading the samples from a different browser. I'll update the step with a plain text downloadable file on my next round of edits soon. For now here is the code in a place you should be able to copy from easily: https://www.arduino.cc/en/Tutorial/ColorCrossfader

Select as Best AnswerUndo Best Answer