Go Down

Topic: Migrated from PC to Mac (Read 329 times) previous topic - next topic


Jan 12, 2013, 10:14 am Last Edit: Jan 12, 2013, 11:05 am by No1Daemon Reason: 1
Hey all

I recently changed to a Mac from PC and I am having trouble getting my sketches running.
for instance the following for a tilt compensated compass worked well before but I cannot make it work now
Code: [Select]
#include <Wire.h>
#include <MMA7660.h>
#include <HMC.h>
int a;
int var_compass;
int getcompasscourse(){
 int ax,ay,az,cx,cz,cy;

 float xh,yh,ayf,axf;
 ayf=ax/57.0;//Convert to rad
 axf=ay/57.0;//Convert to rad

 var_compass=atan2((double)yh,(double)xh) * (180 / PI) -90; // angle in degrees
 if (var_compass>0){var_compass=var_compass-360;}

 return (var_compass);
void setup()

void loop()
 int x,y,z;
 delay(100); // There will be new values every 100ms
 Serial.print("x: ");
 Serial.print(" y: ");
 Serial.print(" z: ");

I believe it is something to do with the updates in the new Arduino version and I have read the release notes but being unfamiliar with Macs I am struggling.
I downloaded the Mac software which was a zip file and when the download was finished it was just an Arduino file which I clicked on and the Arduino environment opened.
I installed the FTI drivers correctly but the issue I am having is errors when verifying about the wire library.
I have no core library folder in my documents folder with Arduino.h or wire.h in it
I read in the release notes that you need to replace
#include <wProgram.h> with <Arduino.h> and that there is a bit of code you can add that includes Arduino.h when needed and uses wProgram.h when needed but I don know where to put it or where to find it.
I have no Arduino.h file on my Mac.

Can someone steer me in the right direction.
Once I have the .h files sorted then I can easily change the wording for Serial etc as per the release notes.

***Edit. I have now edited all the .h files in my libraries to include
#if defined(ARDUINO) && ARDUINO >= 100
 #include "Arduino.h"
 #include "WProgram.h"
However I still get a WProgram.h no such file or folder error. I found the core libraries in the package and copied the libraries folder and pasted it into the Arduino folder but that didnt work either.

***Abort ***Abort ***Abort
I have solved it. Finally tracked down the culprit. I had to edit wire.send and wire.receive etc and edit all the WProgram references but I fixed them.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131