Back to Parent

Reflection

  • I struggled with the particle.function (in exercise 5) because I realized I hadn't understood the syntax really well. This consumed a lot of time for me and I sought a classmate's help and learnt the following:
  • Functions for particle.function start with an 'int' and take only strings (not variables). Hence, first you call out the string through an int, then convert the string to an integer and then use the newly converted int to define something, which in this case is color.
  • Function always has to have a return command, I learnt this the hard way by learning how to writ ethe following syntax:

int setRed(String f){ //functions for particle.function start with an int and take only string commands

int rValue = f.toInt(); //first:convert string to number

uint32_t red = strip.Color(rValue, 0, 0); //second: use the newly converted int to define color

uint16_t i;

for (i=0; i < strip.numPixels(); i++){

strip.setPixelColor(i, red);

strip.show();

}

delay(500);

return 1;


Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0