Nibbles and Bits
The Care and Feeding of My Pet Arduino by Budd Churchward - WB7FHC - NIBBLES AND BITS LIBRARY
«1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 » |
Section 6
Now let's have some fun. In this section, we will wait for the key to come back up. When
it does, we will look at how long it was down and print either a dit or a dah on the
monitor window.
We will need to declare two more variables: boolean ditOrDah=true; int dit=100;You may have to adjust the value of dit to make it match your sending speed. Later we will have our sketch do the adjusting automatically. We are also adding a proceedure called printResults(). For now we will use it to display values so that you can see how they change while you are sending code. Later this proceedure will have a different purpose and we will change its name. As before, copy and paste all the sections highlighted in yellow. Delete the line highlighted in orange. Compile and run the program. You should see your dits and dahs on the Serial Monitor. |
|