So basically, I'm doing a school project where I have to create a radio working on RTTY, I work with an arduino nano and an AD9850 for the frequency generator.
We have all working, we can put a message and it will transmits and we can also receive it.
But now we want to simplify eveything so we wanted to set up the frequency and the messages we want in the serial monitor, but I can't figure out how to.
What I want is : The serial monitor asks "what frequency do you want", then I type it, it says "Your frequency is...." and store the information in my frequency variable (I know how to do that) to tranceive it.
And then, the same thing with the message we want to communicate.
AND basically I want to set up the frenquency only one time, because once I set it up, I want to send multiple messages.
So, my loop look like this, I hope someone will understand what I want and could help, thanks.
You can use Serial.parseInt() or Serial.parseFloat() to read a number typed into Serial Monitor. They have a one-second timeout so it is best to wait until Serial.available() returns a value greater than 0 before trying to parse the input. If a timeout occurs you will get an answer of 0 (or 0.0).
Yes, I know how to read what I type in the serial monitor, it isn't the problem, I want to read 2 different informations in a row, I want the program to print the information for each one, but I don't want it to be spammed in the serial monitor.
I want something like that :
What is your value :
"answer 1"
Your value is : 1
(Then it stores the value in a variable)
What is your string :
"abc"
Your string is : abc
(Then stores the string to a variable)
And if possible, I want the
What is your string :
"abc"
Your string is : abc
(Then stores the string to a variable)
to be repeated so I can send several messages and the
I want something like that :
What is your value :
"answer 1"
Your value is : 1
Oh my, It looks exactly like what I want to achieve, I will test with my program at the university with the radio tomorrow and I'll tell you if it works, but thanks a lot it looks perfectly like what I was thinking of
You helped me a lot, I immediately tested it this morning, it wasn't working at first because I wanted to set a frequency in MHz so I turned the int into a float etc, I changed a bit some things but you had the key, thanks, my problem is solved, if you want me to send you my code let me know