Pages: [1]   Go Down
Author Topic: IDE bug? (Arduino as keyboard)  (Read 1369 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Not sure this is a proper bug or this is the right place, but it's the only forum for bugs.

I was testing several of the examples provided along with the IDE, and then I reached to KeyboardMessage, which prints a message everytime you press a button. I tested on a text editor, it worked nice, but then I decided to print it on the IDE itself, just because. It turns out that the interface quickly starts to print gibberish everytime I press the button, every time printing text less and less similar to what it was supposed to be, until the point that even trying to quit it with the mouse no longer works, and I need to kill it through the OS or a command line.

The issue arises when I start to press the pushbutton more quickly. Maybe the interface can't handle the fast text input (however, even the sluggish Eclipse stays fine, despite the quite long freezes after some text, every couple clicks). May not be an "acceptable" bug, but still funny "breaking" the Arduino IDE with an Arduino smiley-razz

A screenshot is attached.

Environment:
Ubuntu 13.10 64 bits
Arduino IDE 1.0.5
Borderless Electronics Leonardo-compatible board (no quality issues whatsoever so far, dozens of examples tested - I tested pretty much everything from the basic examples up to "08.Strings" plus a few independent ones)
Text printing tested on gedit (simple text editor), LibreOffice Writer, Eclipse IDE, all of them work and no hangs.


* Screenshot from 2013-11-24 16:58:12.png (246.99 KB, 1280x960 - viewed 51 times.)
« Last Edit: November 24, 2013, 02:03:27 pm by mdrg » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but then I decided to print it on the IDE itself
The Arduino can't communicate with the IDE. Did you mean the Serial Monitor? That is a separate application.

What code are you running?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi PaulS,

I was not communicating with the IDE, just using it as a common text editor, as I did with gedit, LibreOffice Writer and Eclipse IDE.
Take a look at the screenshot, it will be clearer.

The code is this example:

Code:
const int buttonPin = 4;          // input pin for pushbutton
int previousButtonState = HIGH;   // for checking the state of a pushButton
int counter = 0;                  // button push counter

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState)
    // and it's currently pressed:
  && (buttonState == HIGH)) {
    // increment the button counter
    counter++;
    // type out a message
    Keyboard.print("You pressed the button ");
    Keyboard.print(counter);
    Keyboard.println(" times.");
  }
  // save the current button state for comparison next time:
  previousButtonState = buttonState;
}
Logged

Pages: [1]   Go Up
Jump to: