Go Down

Topic: Fox Hunt for Amatrue Radio (Read 3289 times) previous topic - next topic


In the for loop, the first part is used to initialize one or more variables. The way you have it written, the variable is declared but not initialized. It will have whatever random value is on the stack when the for loop is executed. You have been lucky that the stack value happened to be zero (or possibly a small negative number) which will give the correct output. If later on, you or someone else changes the code, the value on the stack may change and the sketch will start acting strangely with no apparent cause.
You should use this:
Code: [Select]
  for (int currentLetterIndex = 0; currentLetterIndex < sizeof(message); currentLetterIndex++) {

Another very minor fix is to remove this pair of braces in the setup function after the delay statement.
Code: [Select]

They do nothing and the compiler will ignore them.

Your code will be more readable if you use the Tools|Auto Format menu item in the IDE.


Thanks Pete for the suggestions I found the Auto Format and will use that from now on.  I am also appreciative of the knowledge that you gave about the currentLetterIndex I have made that change as well.


K7TSF I would hope in your ham radio class you were taught how to read and draw basic circuit diagrams.
So can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

You picture does not show the relay board top.
You are trying to connect to this?

Tom... :)

I hope this is what you were looking for.  The Baofeng uses a Grounding of the Speaker - to activate the PTT no voltage is going through the Switching part of the relay.  Only other connections are 5v Ground and a Switch in to control the switch.  Attached is a picture of the relay I used.  It has a 3 terminal for normally open normally closed and common.  I only used the common and normally open sides of the relay.

Go Up