# Greg

### Arduino Programming RGB LED sketch Help?

Hi

I need help with this program that allows a user to control the color of an RGB LED using the numbers 0-255. While this program successfully allows the user to freely control the LED, I cannot figure out how to put parameters in the RGB_function or Void Loop function that makes it so the user gets an error if they enter an incorrect value (if they go outside the 0-255 range). Thank you for the help, the photo shows notes

int temp;int redPin = 11;int greenPin = 10;int bluePin = 9;char redLED;char greenLED;char blueLED; String Message1 = "RBG LED program\n";String Message2 = "Thank you for your inputs\n";String Message3 = "Invalid integer \n";void setup() { Serial.begin(9600); pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); Serial.println(Message1); delay(1000);}void RGB_Function(){ delay(50); Serial.println("please enter RED, GREEN, and BLUE vars"); while(Serial.available() == 0){ } redLED = Serial.parseInt(); greenLED = Serial.parseInt(); blueLED = Serial.parseInt(); temp = Serial.parseInt();}void loop() { RGB_Function(); analogWrite(redPin, redLED); analogWrite(greenPin, greenLED); analogWrite(bluePin, blueLED); Serial.println(Message2); delay(500); }void setColor(int red, int green, int blue){ #ifdef COMMON_ANODE red = 255 - red; green = 255 - green; blue = 255 - blue; #endif analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue);}

Programming & Design1 month ago### How to focus during online classes?

Hello,

I have been finding that during online classes, I tend to lose focus and become sidetracked with other distractions. I was hoping someone could give me some tips or advice on how to stay focused. Anything helps

Thanks

1 AnswerOther - Education3 months ago### Controls Homework Question?

Consider the system with the transfer function

G(s) = 4/(s^2+ (1 +α)s+ 4)

(a) For what range of α is the system is over-damped?

(b) For what range of α is the system is under-damped?

(c) What range ofαwill result in the system’s response having a time constant of 1second?

Need help with this problem, anything helps, Thanks

Engineering1 year ago### Control Systems Hw question?

Consider the system with the transfer function

G(s) = 4/(s^2+ (1 +α)s+ 4)

(a) For what range of α is the system is over-damped?

(b) For what range of α is the system is under-damped?

(c) What range ofαwill result in the system’s response having a time constant of 1second?

Need help with this problem, anything helps, Thanks

1 AnswerEngineering1 year ago### Electronics HW question?

During the day, the ac line voltage changes. This causes the unregulated 24-V output of the power supply to vary from 21.5 to 25 V. If the zener resistance is 14 V, what is the voltage change over the foregoing range?

can you please explain the steps to solving this as I could not find an example in the book and my professor didn't explain how to do this problem

anything helps, thank you

4 AnswersEngineering1 year ago### inverse Laplace transformation with matlab?

Calculate the inverse Laplace Transform of the following rational transfer function?(You need to use partial fraction expansion - MATLAB residue function can be used.)

F(s)= 5/(s^2-s-6)

so i plugged the formula above into Matlab and got r= 1 -1 p= 3 -2 and k = [ ], but I am a little confused on where to go from there

anything helps

1 AnswerMathematics1 year ago### Hw Question-Laplace Transformation?

Calculate the Laplace Transform of the following time functions (u(t) is the unit step input)? Please use Laplace transform table.

f(t)=5u(t)+3e^-2t

1 AnswerMathematics1 year ago### Control Systems HW question?

Please refer to picture, I don't understand this problem (with the exception of a), and would like an explanation of work/answer, anything helps!

(b) Using the equation above, find the transfer function from the input voltage vi(t)and the current i(t);

i.e. find I(s)/Vi(s).

(c) Assume that vi(t) = 0 for t >0 and i(0) =/= 0 . Does i(t) tend to zero as t→∞? Justify.

1 AnswerEngineering1 year ago### A control system described by a differential equation?

A system is described by the differential equation

y^(4)+y^(3)+ 5y^(2)+ 7y^(1)+y=u^(3)+ 2u^(2)+ 3u^(1)+ 7u.

Find the transfer function Y(s)/U(s) (Assume zero initial conditions).

2 AnswersMathematics1 year ago