Page 15 of 22

Re: Detector Building C

Posted: January 28th, 2020, 5:02 am
by l0lit
fyuan483 wrote: January 27th, 2020, 7:36 pm hi. the temperatures are chosen after all teams are at competition site right?
If you meant the temperature ranges for the LEDs, then yes you will only know the ranges once you walk into the testing room and they start.

Re: Detector Building C

Posted: January 28th, 2020, 6:15 am
by fyuan483
l0lit wrote: January 28th, 2020, 5:02 am
fyuan483 wrote: January 27th, 2020, 7:36 pm hi. the temperatures are chosen after all teams are at competition site right?
If you meant the temperature ranges for the LEDs, then yes you will only know the ranges once you walk into the testing room and they start.
yes i meant this. thank you for clearing this up.

Re: Detector Building C

Posted: January 29th, 2020, 5:05 pm
by MTV<=>Operator
Sorry if this was answered already, but on the rules it states that you might be required to display more than one LED color at a time. In other words, the ranges will overlap. How would one do this?

Re: Detector Building C

Posted: January 29th, 2020, 7:37 pm
by LIPX3
MTV<=>Operator wrote: January 29th, 2020, 5:05 pm Sorry if this was answered already, but on the rules it states that you might be required to display more than one LED color at a time. In other words, the ranges will overlap. How would one do this?
How is having multiple LEDs on at once any more difficult than having a single LED on at once?

Re: Detector Building C

Posted: January 30th, 2020, 3:59 pm
by fyuan483
hi. i was wondering how many program codes do we need in total? is it one program code for the led lights, one for the analog, one for the temperature, and one for the voltage? Or is it like combining some programs together?

Re: Detector Building C

Posted: January 30th, 2020, 4:28 pm
by lindsmaurer
fyuan483 wrote: January 30th, 2020, 3:59 pm hi. i was wondering how many program codes do we need in total? is it one program code for the led lights, one for the analog, one for the temperature, and one for the voltage? Or is it like combining some programs together?
Do whatever works for your device.
If you’re asking about logs, my highlights are on one set of code instead of multiple copies

Re: Detector Building C

Posted: January 30th, 2020, 5:04 pm
by fyuan483
lindsmaurer wrote: January 30th, 2020, 4:28 pm
fyuan483 wrote: January 30th, 2020, 3:59 pm hi. i was wondering how many program codes do we need in total? is it one program code for the led lights, one for the analog, one for the temperature, and one for the voltage? Or is it like combining some programs together?
Do whatever works for your device.
If you’re asking about logs, my highlights are on one set of code instead of multiple copies
so there is not a restricted amount of codes? i just need a program(s) to make my device work right?

Re: Detector Building C

Posted: January 30th, 2020, 7:26 pm
by MTV<=>Operator
LIPX3 wrote: January 29th, 2020, 7:37 pm
MTV<=>Operator wrote: January 29th, 2020, 5:05 pm Sorry if this was answered already, but on the rules it states that you might be required to display more than one LED color at a time. In other words, the ranges will overlap. How would one do this?
How is having multiple LEDs on at once any more difficult than having a single LED on at once?
For a single LED at once, you only need 3 temperature ranges, one for each LED. But if part of one range requires two LEDs to be on but another part of that range requires only one LED to be on, how would you do this? I tried making 5 temperature ranges, 3 for a single LED and 2 for multiple LEDs, but compound inequalities don't seem to work in the arduino code. Did I just misinterpret the rules?

Re: Detector Building C

Posted: January 30th, 2020, 8:13 pm
by pepperonipi
MTV<=>Operator wrote: January 30th, 2020, 7:26 pm
LIPX3 wrote: January 29th, 2020, 7:37 pm
MTV<=>Operator wrote: January 29th, 2020, 5:05 pm Sorry if this was answered already, but on the rules it states that you might be required to display more than one LED color at a time. In other words, the ranges will overlap. How would one do this?
How is having multiple LEDs on at once any more difficult than having a single LED on at once?
For a single LED at once, you only need 3 temperature ranges, one for each LED. But if part of one range requires two LEDs to be on but another part of that range requires only one LED to be on, how would you do this? I tried making 5 temperature ranges, 3 for a single LED and 2 for multiple LEDs, but compound inequalities don't seem to work in the arduino code. Did I just misinterpret the rules?
That's where the beauty of multiple "else if" statements can help you. The code will select the first case that is true and run the code inside. In this case, if temp = 33, it would skip over the first block of code and move to the second block, triggering the red and blue LEDs simultaneously.

Code: Select all

if (temp < 25) {
  // Red Only
  redLED(on); 
  greenLED(off); 
  blueLED(off);
} else if (temp < 35) {
  // Red and Blue
  redLED(on);
  greenLED(off);
  blueLED(on);
} else if (temp < 50) {
  // Green Only
  redLED(off); 
  greenLED(on); 
  blueLED(off);
} else if (temp < 75) {
  // Blue Only
  redLED(off);
  greenLED(off);
  blueLED(on);
}

Re: Detector Building C

Posted: January 31st, 2020, 6:02 am
by LIPX3
pepperonipi wrote: January 30th, 2020, 8:13 pm
MTV<=>Operator wrote: January 30th, 2020, 7:26 pm
LIPX3 wrote: January 29th, 2020, 7:37 pm
How is having multiple LEDs on at once any more difficult than having a single LED on at once?
For a single LED at once, you only need 3 temperature ranges, one for each LED. But if part of one range requires two LEDs to be on but another part of that range requires only one LED to be on, how would you do this? I tried making 5 temperature ranges, 3 for a single LED and 2 for multiple LEDs, but compound inequalities don't seem to work in the arduino code. Did I just misinterpret the rules?
That's where the beauty of multiple "else if" statements can help you. The code will select the first case that is true and run the code inside. In this case, if temp = 33, it would skip over the first block of code and move to the second block, triggering the red and blue LEDs simultaneously.

Code: Select all

if (temp < 25) {
  // Red Only
  redLED(on); 
  greenLED(off); 
  blueLED(off);
} else if (temp < 35) {
  // Red and Blue
  redLED(on);
  greenLED(off);
  blueLED(on);
} else if (temp < 50) {
  // Green Only
  redLED(off); 
  greenLED(on); 
  blueLED(off);
} else if (temp < 75) {
  // Blue Only
  redLED(off);
  greenLED(off);
  blueLED(on);
}
This provides a sufficient example. There's no need to make 5 temperature ranges - just make each temperature range control the LEDs as required.