03-07-2006 06:33 PM
03-07-2006 07:55 PM
03-07-2006 08:20 PM
03-07-2006 09:56 PM
03-31-2018 02:05 AM
@leroy27336 wrote:
Altenbach,
I downloaded the evaluation version of 8 to open up your .vi you made. I then created that same code in 6.1 and it worked. Thanks brother. I appreciate your help.
Is your problem solved men ??
if it is not I well tell you the solution.
First : I have defined yellow led as pin 6, green led as pin 5 , red led as pin 3, button as 4
I am working at arduino uno so let's begin
I will first define : int sensorvalue =digitalRead(4)
you should define a variable like saying : int variable = 0 for recording changes
then you should increase the amount of this variable every time the button is pressed like saying
if(sensor value == HIGH)
{ variable = variable + 1 // Increase the amount of the variable
Serial.println(variable); // record the variable
delay(100);
}
// Light the first Led (yellow led)
if(variable>=0 &&variable<=50)
{ analogWrite(yellow_led,255);
analogWrite(red_led,0);
analogWrite(green_led,0);
}
// Light the second led (green led)
if (variable>50 && variable<=100)
{
analogWrite(yellow_led,0);
analogWrite(red_led,0);
analogWrite(green_led,255);
}
// Light the third led (red led)
if (variable>100 && variable<150)
{
analogWrite(yellow_led,0);
analogWrite(red_led,255);
analogWrite(green_led,0);
}
// returning the variable to 0
if(variable==150)
{variable=0;}
I will download the code and make sure you download the last version of IDE 1.8.5
I hope you understand.
and I hope this was helpful.
MOHAMAD
03-31-2018 02:07 AM
Hi there ! Sorry they don't let me send you the code