Page 1 of 1
serial input

Posted:
Thu Mar 29, 2012 12:37 pm
by zhengkoon8
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
Re: serial input

Posted:
Thu Mar 29, 2012 1:39 pm
by shahrul
1. I think no.
2. <blank>
3. Maybe you need to interface Arduino with USB/PS2 keyboard and display through serial monitor.
Re: serial input

Posted:
Thu Mar 29, 2012 4:39 pm
by Idris
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?
Re: serial input

Posted:
Thu Mar 29, 2012 4:47 pm
by zhengkoon8
no, but is after press w then press a without release w.
Re: serial input

Posted:
Thu Mar 29, 2012 4:53 pm
by Idris
Hmm not sure about that, try using hyperterminal first, what happen to the data when 2 button press together.
Re: serial input

Posted:
Thu Mar 29, 2012 5:10 pm
by zhengkoon8
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();
}
}