void setup() {
display = new CharDisplay(1);
joystick = new Joystick(3);
}
SO: ==> Which is the correct way of doing this, and any reason why Joystick won’t run? I get the following errors:
‘delay’ was not declared in this scope
error: ‘byte’ does not name a type
Joystick.ino: In function ‘void loop()’:
Joystick:47: error: ‘delay’ was not declared in this scope
Here’s the full Joystick code:
#include <Gadgeteering.h>
#include <FEZMedusa.h>
#include <SPI.h>
#include <IO60P16.h>
#include <CharDisplay.h>
#include <Joystick.h>
using namespace GHI;
using namespace GHI::Interfaces;
using namespace GHI::Modules;
using namespace GHI::Mainboards;
FEZMedusa board;
CharDisplay* display;
Joystick* joystick;
void setup() {
display = new CharDisplay(1);
joystick = new Joystick(3);
}
void loop() {
int xVal = (int)(joystick->getX() * 10.0);
int yVal = (int)(joystick->getY() * 10.0);
display->clear();
display->print((char)xVal + 48);
display->print((char)yVal + 48);
display->print(joystick->isPressed() ? "P" : "N");
delay(500);
}
Well, this is strange. Suddenly can’t compile Blink for Arduino either. Clearly a problem with the IDE, now I just have to find out WHAT that problem is. Using 1.0.5 on OSX.
Blink errors, in case anyone has bright ideas:
Blink.ino:10:21: error: Arduino.h: No such file or directory
Blink.ino: In function ‘void setup()’:
Blink:15: error: ‘OUTPUT’ was not declared in this scope
Blink:15: error: ‘pinMode’ was not declared in this scope
Blink.ino: In function ‘void loop()’:
Blink:20: error: ‘HIGH’ was not declared in this scope
Blink:20: error: ‘digitalWrite’ was not declared in this scope
Blink:21: error: ‘delay’ was not declared in this scope
Blink:22: error: ‘LOW’ was not declared in this scope
I’m not sure if this has anything to do with it, but we noticed a bug on Linux, so it may be shared with other unix-like environments. When using the 64bit 1.5.4 package for the arduino IDE the compilers for some of the boards were still 32bit. This was not documented and resulted in a simple “command not found” style of error. After some digging, Jeff discovered they were 32bit binaries and worked once the lib32 packages were installed.
Found the problem, I was trying to follow this instruction on a Mac:
Copy or move the file boards.txt from the Arduino\Hardware folder to C:\Program Files (x86)\Arduino\hardware\arduino.
Couldn’t find a Program Files folder, so I made a new folder under Arduino called hardware, and another one under that called arduino, and put boards.txt in there. Clearly not correct.
Go to your Documents (~/Documents) folder and open the Arduino directory (create it if it doesn’t exist). Create another folder within there called hardware and then one more within that called hexbright. Drop boards.txt in there. You can also download the hardware folder from the samples within the GitHub project and put it directly in the Arduino directory, as shown in the screenshot.
For the current version or Arduino on Mac OS X 10.8.x you will need to right click on Arduino.app
in the applications folder and choose “Show Package Contents” from there navigate to: /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/boards.txt
Open the boards.txt file from the file path as well as the one you downloaded. Copy the contents of the downloaded one to the top of the file in Arduino.app. Save the file and reopen Arduino.app. From there you can Navigate to Tools > Board > HexBright.
@ spongefile - Glad you found a solution!! Good job! Some steps I suggest you use:
[ol]for the [em]boards.txt[/em] that comes with GHI’s package and/or gitbucket, edit it and remove all text from the file other than the the lines that start with "medusa."
create this path if it doesn’t exist: ~[em]/Documents/Arduino/hardware/GHI/[/em]
Install edited GHI [em]boards.txt[/em] (from step 1) into ~[em]/Documents/Arduino/hardware/GHI/[/em]
leave the original[em] boards.txt[/em] (from the Arduino package) where it was installed.[/ol]
Benefit of this is that anytime you download a new Arduino environment you’ll get all their changes, and any time you get a new [em]boards.txt[/em] from GHIElectronics, there will never be a conflict and you’ll have the latest from both companies.