I am relatively new to Arduino and CS, but I think I've encountered a bug. I have created a program that's supposed talk in Morse code via LED lights (Arduino Uno), and there are three leds, all connected to their own pins of the Arduino. I tried creating a function to change what pin every letter in Morse code is flashed on, so it goes like pin1, then pin2, then pin3, and repeat, but it doesn't change what pin the led is flashing on.
to break down the code,
Dot and Dash functions, just turn LEDs on and off at the current pin variable and running FC_Pin every time they run changes.
Function Current Pin (FC_Pin) - Changes the current pin
Alphabet - Each letter has it's own function, which are just functions to run the Dot and Dash functions.
SUMMARY: A function to change a variable between 3 different values In order when it's run isn't working
Here is the function to change the pin (Pin 1, 2, and 3 are variables for pins on the board)
void FC_Pin () {
/*FUNCTION CURRENT PIN, EVERYTIME THE FUNCTION IS RUN, THE VARIABLE CHANGES
Also, the ONLY THING this function does is changes the C_Pin, which is a NORMAL VARIABLE, and not a function.
So every time an LED is set to blink, it should be typed like "LEDBLINK (Cpin, High)", or in other words,
Blink an LED on the Current pin while calling on the VARIABLE, not the function.
*/
if (C_Pin = pin_3) {
//NEXT PIN IS PIN 1
int C_Pin = pin_1;
}
else if (C_Pin = pin_1) {
//NEXT PIN IS PIN 2
int C_Pin = pin_2;
}
else {
//NEXT PIN IS PIN 3
int C_Pin = pin_3;
};
};
Link to the program (It's public)->
Thanks for your help!