I would like to shift the data in the array as I push a button on an IR remote. My current code shown below, the analogWrite outputs the 5 elements in the array every 2 seconds after I press the button on the remote. I want it to wait to increment until I press the button again on the remote.
Any takers on trying to provide some direction?
Thanks, stay safe.
Any takers on trying to provide some direction?
Thanks, stay safe.
C++:
#include <IRremote.h>
const int analogOutPin = 9; //PWM (Motor) Output
const int RECV_PIN = 8; //RF Reciever input
int outputValue = 0;
int SpeedArray[5] = {254, 220, 190, 160, 145};
int count = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
// Enable the IR Receiver
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
if (results.value = 0x150C)
{
for (count = 0; count < 5; count++)
{
analogWrite(analogOutPin, SpeedArray[count]);
delay(2000);
analogWrite(analogOutPin, 0);
}
}
irrecv.resume();
}
}