I recently just started programming, mainly in Java but I have touched the "c" languages recently, and I am also new to Arduino. I am interested in robotics and I just recently moved up from using Lego NXT to the Arduino. No more drag and drop :P. Anyways I got a NXShield so my NXT parts don't go to waste and I'm running into problems. I created a sketch and fixed all of the compiler errors and then a big boom of errors happened, which I don't know how to fix. I also added the NXShield c++ files to the Arduino library.
The Sketch:
#include <Wire.h>
#include <NXShield.h>
#include <PFMate.h>
NXShield NXShield;
PFMate PFMate;
void setup ()
{
char str[256];
Serial.begin(115200); // start serial for output
delay(500); // wait, allowing time to activate the serial monitor
Serial.println (FILE);
Serial.println ("Initializing the devices ...");
NXShield.init( SH_SoftwareI2C );
Serial.println ("Press GO button to continue");
NXShield.waitForButtonPress(BTN_GO);
//
// Initialize the i2c sensors.
//
PFMate.init( &NXShield, SH_BBS2 );
}
void loop()
{
char aa[80];
char str[256];
int bb_us;
strcpy(aa, PFMate.getDeviceID() );
sprintf (str, "PFMate: DeviceID: %s", aa);
Serial.println(str);
strcpy(aa, PFMate.getVendorID() );
sprintf (str, "PFMate: VendorID: %s", aa);
Serial.println(str);
sprintf (str, "PFMate: loling: %d mm", bb_us );
Serial.println(str);
}
The Errors:
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp:24:18: error: Wire.h: No such file or directory
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp:27:33: error: ../Wire/utility/twi.h: No such file or directory
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp: In member function 'void BaseI2CDevice::initProtocol()':
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp:53: error: 'Wire' was not declared in this scope
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp: In member function 'uint8_t* BaseI2CDevice::readRegisters(uint8_t, uint8_t, uint8_t*, uint8_t, bool)':
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp:86: error: 'Wire' was not declared in this scope
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp: In member function 'bool BaseI2CDevice::writeRegisters(uint8_t, uint8_t, uint8_t*)':
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp:162: error: 'Wire' was not declared in this scope
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp: In member function 'bool BaseI2CDevice::checkAddress()':
C:\Users\Zachary\Desktop\arduino-1.0\hardware\arduino\cores\arduino\BaseI2CDevice.cpp:260: error: 'twi_writeTo' was not declared in this scope
As you can tell I'm trying to use the PFMate as well. I am also confused as to how to write to it, since it controls motors over IR. If anyone could help with that too, I would really appreciate it.
- Zachary