serial input

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

serial input

Postby zhengkoon8 » Thu Mar 29, 2012 12:37 pm

Hi,

I need help to this

1. is arduino serial monitor can detect 2 button press in keyboard?

2. if can, is there anyway to program it if i using switch case to detect one of the input?

3. if not, is it any code for detect the keyboard press hold?

Thanks and regards

zheng koon
zhengkoon8
Newbie
 
Posts: 10
Joined: Mon Mar 05, 2012 3:34 pm

Re: serial input

Postby shahrul » Thu Mar 29, 2012 1:39 pm

1. I think no.
2. <blank>
3. Maybe you need to interface Arduino with USB/PS2 keyboard and display through serial monitor.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: serial input

Postby Idris » Thu Mar 29, 2012 4:39 pm

zhengkoon8 WROTE:Hi,

I need help to this

1. is arduino serial monitor can detect 2 button press in keyboard?

2. if can, is there anyway to program it if i using switch case to detect one of the input?

3. if not, is it any code for detect the keyboard press hold?

Thanks and regards

Did you mean 2 button pressed in one time?
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: serial input

Postby zhengkoon8 » Thu Mar 29, 2012 4:47 pm

no, but is after press w then press a without release w.
zhengkoon8
Newbie
 
Posts: 10
Joined: Mon Mar 05, 2012 3:34 pm

Re: serial input

Postby Idris » Thu Mar 29, 2012 4:53 pm

Hmm not sure about that, try using hyperterminal first, what happen to the data when 2 button press together.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: serial input

Postby zhengkoon8 » Thu Mar 29, 2012 5:10 pm

it will do one comment then go back the loop and do another one. what i is something like this

bool forward;
bool turn;

loop() {
if (Serial.available()) {
int ch = Serial.readChar(); // I forget the exact function
switch (ch) {
case 'w': forward = true;
case 's': forward = false;
case 'a': turn = true;
case 'd': turn = false;
}
}
if (forward) {
if (Serial.read()='a')
{
*doing forward and turning*;
}
else {
set_stop_signals();
}
}
else {
set_stop_signals();
}
if (turn) {
set_turn_signals();
}
else {
set_straight_signals();
}
}
zhengkoon8
Newbie
 
Posts: 10
Joined: Mon Mar 05, 2012 3:34 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 19 guests