Go Down

Topic: inserting 2 numbers at same time in serial monitor? (Read 324 times) previous topic - next topic

cr0wl

Hello, i was just wandering could i type 2 separated numbers or word and number at same time?
i searched on other forums but nothing useful... anyway lets say i want type servo number and degrees at same time, so i dont need type " servo1 " then enter and then " 90 ", but lets say "servo1 90" or "servo1-90" or "servo1/90" or whatever to separate them?

DrAzzy

Yes, absolutely.

Have you read the Serial Input Basics thread? That should cover this.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Robin2

Two or three hours spent thinking and reading documentation solves most programming problems.

cr0wl

sorry, im very fresh and didnt really understand how to do it from there :/

dougp

sorry, im very fresh and didnt really understand how to do it from there :/
Have you loaded and run the serial input programs?  Doing this and then tweaking them in small ways to observe results will expand your understanding. Keep in mind that these are examples, they probably won't do exactly what you need.  They are stepping stones you can use to create more advanced/custom code.

Since you will at some point need to parse the input data, some familiarity with the AVR string library will be helpful.
So two neutrinos went into a bar.  Nothing happened.  They were just passing through.

Robin2

sorry, im very fresh and didnt really understand how to do it from there :/
If you describe what you did not understand I will try to help.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

cr0wl

well i know how to insert only 1 per time with this code

Code: [Select]


Part of code

void loop()
{
 while(Serial.available()>0)
 {
 servo=Serial.parseInt();
 num2=Serial.parseInt(); 

 if(servo==1){servo1.write(num2,50,true);}

 }
}


but i dont know any further

i'm in a bit hurry so dont have lot of time to research
so could you please highlight me part that i need so i can edit and use it?

septillion

i'm in a bit hurry so dont have lot of time to research
That's your problem ;) You can always pay someone if you need it :)

so could you please highlight me part that i need so i can edit and use it?
Uhm, pretty much everything ;)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Robin2

well i know how to insert only 1 per time with this code
May I suggest that you try the parse example in Serial Input Basics. Get the example working the way it is intended and after that see about modifying it to do exactly what you need.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up