Arduino 1.0.5 behavior problem

Status
Not open for further replies.

wolfv

Well-known member
The following code is from a file named keyboard.ino.
It does not print "y" when in a folder with 20 other .cpp and .h files.
I want to test the 20 other files, and Arduino 1.0.5 compiles them with no complaints.

I copied the code into a new file and placed it in a folder with no other files.
The code printed "y" like it should.
What could cause the code to print in one folder and not the other?
I am using Teensy2.0 and Arduino 1.0.5 IDE on Windows 7.

Lines 3 through 21 are commented, "y" prints on lines 27 and 33:
Code:
#include <Wire.h>
#include <Keyboard.h>
/*
#include "Keyb.h"

Keyb keyb;

void setup()
{
	keyb.begin();
	Keyboard.begin();
	delay(2000);
	Keyboard.write('Y');
}

void loop()
{
	keyb.scan();
	while (1) {}
}
*/
void setup()
{
	Keyboard.begin();
	delay(2000);
	Keyboard.write('Y'); // Keyoard.begin() takes more than 1 second
}

void loop()
{
	delay(1000);
	Keyboard.press(KEY_Y);
	Keyboard.release(KEY_Y);
	
}

Thanks for taking a look.
 
Are you going to post Keyb.h and whatever other code is interfering? I don't see any way to get to the bottom of this without knowing what that other code is doing.
 
I found the problem. The following xkeyboard4.cpp file was in the folder:

Code:
#include "Keyb.h"

Keyb keyb;

int main()
{
	keyb.begin();
	keyb.scan();
	return 0;
}
After testing in g++, I switched to Arduino IDE which compiled and uploaded the code, but there was no output.
The xkeyboard4.cpp file was left over from when I was using g++ to compile and test.
After removing the xkeyboard4.cpp file, and uploading with Arduino IDE, the code printed "y" as expected.
Somehow the xkeyboard4.cpp file interfered with running the keyboard4.ino file:confused:
 
Status
Not open for further replies.
Back
Top