Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+10 votes

We are trying to hook up keys to the dit and dah buttons.

asked in CSC 305 Fall 2024 by (4.9k points)

1 Answer

+4 votes
 
Best answer

I think the easiest way of doing it would be to just set the onPressed and onReleased actions of the key to call the same methods that you were calling when you were pressing the buttons.

If you are wanting to just add a dit or a dah for each time that you press the key, then you will probably only have to set the onPressed action, but if you are wanting to continuously add dit's or dah's, then you will have to either specify the length of the dits or dahs and then continuously play them until you release the key, or you can start a timer and calculate how long you held the key down for and then add the dits or dahs based on how long you specified them as.

answered by (2.4k points)
selected by
...