Preciso da librarie icrmacros.h

icrmacros.h seria uma bibioteca, certo? Eu preciso dela e não sei onde achar! :confused:

Este é o primeiro resultado que devolve o Google.

Já agora, qual é o sketch onde isto vai ser usado (não haja por aí outro erro).

Estou usando o Arduino UNO.

#include <icrmacros.h>
#include <SoftwareSerial.h>
float stepsize = 1.8/50.0;
float motorpos = 0.0;
float phimirror = atan(120.0/2080.0);
int limitswitch3 = 0;
SoftwareSerial mySerial(2,3);
void setup()
{
pinMode(13, OUTPUT);
Serial.begin(9600);
digitalWrite(13, LOW);
pinMode(8, OUTPUT);
pinMode(6, INPUT);
pinMode(7, OUTPUT);
pinMode(10, INPUT);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
pinMode(2, INPUT);
mySerial.begin(9600);
int limitiswitch = 0;
while (limitswitch != 1)
{
digitalWrite(8,LOW);
delay(5);
digitalWrite(8,HIGH);
delay(5);
//Serial.print(“1”);
if (digitalRead(6) == LOW)
{
delay(1000);
if (digitalRead(6) == LOW)
{
limitswitch = 1;
limitswitch3 =1;
}
}
}
motorpos = 0.0;
Serial.println(“End setup”);
digitalWrite(13,HIGH);
}
// MAIN LOOP
void loop()
{
int serialStringPosition;
char inByte;
char serialString[250];
const char beginChar = ‘*’;

int commaPosition =0;
int commaString[20];
int numCommas = 0;

for (int j=0;j<20;j++)
{
commaString[j] = 0;
}
for (int i=0;i<250;i++)
{
serialString = ’ ';
}
if (digitalRead(10) == LOW)
{
delay(2000);
if (digitalRead(10) == LOW)
{
delay(3000);
if (digitalRead(10) == LOW)
{
while (limitswitch3 != 1)
{
digitalWrite(8,LOW);
delay(5);
digitalWrite(8,HIGH);
delay(5);
Serial.print(“1”);
if (digitalRead(6) == LOW)
{
delay(1000);
if (digitalRead(6) == LOW)
{
limitswitch3 = 1;
}
}
}
Serial.println(“No track”);
motorpos = 0.0;
Serial.print("New motorpos: ");Serial.println(motorpos);
}
}
}
else{
if (mySerial.available())
{
delay(1);
serialStringPosition =0;
//while (mySerial.available())
//{
for (int j=0;j<250;j++)
{
inByte = mySerial.read();
serialString[j] = inByte;
delay(1);
}
//}
Serial.println(serialString);
int endpos = 0;
int startpos = 0;
for (int k=0;k<250;k++)
{
if (serialString[k] == ‘$’ && serialString[k+1] == ‘G’ && serialString[k+2] == ‘P’)
{
if (serialString[k+3] == ‘Z’ && serialString[k+4] == ‘D’ && serialString[k+5] == ‘A’)
{
Serial.println(“Right string”);
Serial.println(k);
startpos = k;
char checkByte = serialString[k];
endpos = k;
while (checkByte != ‘*’)
{
endpos++;
checkByte = serialString[endpos];
}
Serial.println(endpos);
}// End if ZDA
}// End if $GP
}// End for
if (endpos != 0 && startpos != 0)
{
for (int l=startpos;l<endpos;l++)
{
char currentChar = serialString[l];
if (currentChar == ‘,’)
{
commaString[numCommas] = l;
numCommas++;
}
}
int checkGPS1 = commaString[0] +1;
int checkGPS2 = commaString[1];
int checkGPS3 = commaString[2] +1;
int checkGPS4 = commaString[3];
if (checkGPS1 == checkGPS2 || checkGPS3 == checkGPS4)
{
Serial.println(“GPS not locked on”);
} else
{
Serial.println(“GPS locked on”);
int h1 = serialString[commaString[0]+1];
int h2 = serialString[commaString[0]+2];
int m1 = serialString[commaString[0]+3];
int m2 = serialString[commaString[0]+4];
int s1 = serialString[commaString[0]+5];
int s2 = serialString[commaString[0]+6];
int D1 = serialString[commaString[1]+1];
int D2 = serialString[commaString[1]+2];
int M1 = serialString[commaString[2]+1];
int M2 = serialString[commaString[2]+2];
int Y1 = serialString[commaString[3]+1];
int Y2 = serialString[commaString[3]+2];
int Y3 = serialString[commaString[3]+3];
int Y4 = serialString[commaString[3]+4];
int Hourval = 10*(h1-48) + (h2-48)+ 2;
int Minuteval = 10*(m1-48) + (m2-48);
int Secondval = 10*(s1-48) + (s2-48);
int Yearval = 1000*(Y1-48)+100*(Y2-48)+10*(Y3-48) + (Y4-48);
int Monthval = 10*(M1-48) + (M2-48);
int Dayval = 10*(D1-48) + (D2-48);
Serial.print("Hour: ");Serial.println(Hourval);
Serial.print("Minute: ");Serial.println(Minuteval);
Serial.print("Second: ");Serial.println(Secondval);
//
if (Hourval >0 && Minuteval >0 && Secondval>0 && Yearval >0 && Monthval >0 && Dayval >0)
{
float leapyearcheck1 = Yearval/4.0;
float leapyearcheck2 = Yearval/4;
int leapyear = 0;
if (leapyearcheck1 == leapyearcheck2)
{
leapyear = 1;
} else
{
leapyear = 0;
}
int daynumber = 1;
switch (Monthval) {
case 1:
daynumber = Dayval;
break;
case 2:
daynumber = Dayval + 31;
break;
case 3:
daynumber = Dayval + 59 +leapyear;
break;
case 4:
daynumber = Dayval + 90 +leapyear;
break;
case 5:
daynumber = Dayval + 120 +leapyear;
break;
case 6:
daynumber = Dayval + 151 +leapyear;
break;
case 7:
daynumber = Dayval + 181 +leapyear;
break;
Stellenbosch University http://scholar.sun.ac.za
118
case 8:
daynumber = Dayval + 212 +leapyear;
break;
case 9:
daynumber = Dayval + 243 +leapyear;
break;
case 10:
daynumber = Dayval + 273 +leapyear;
break;
case 11:
daynumber = Dayval + 304 +leapyear;
break;
case 12:
daynumber = Dayval + 334 +leapyear;
break;
}
int daynum = 1;
switch(Yearval) {
case 2012:
daynum = daynumber;
break;
case 2013:
daynum = daynumber + 366;
break;
case 2014:
daynum = daynumber + 731;
break;
case 2015:
daynum = daynumber +1096;
break;
case 2016:
daynum = daynumber;
break;
case 2017:
daynum = daynumber + 366;
break;
case 2018:
daynum = daynumber + 731;
break;
case 2019:
daynum = daynumber + 1096;
break;
default:
daynum = daynumber;
}
float EOT1 = 0.0002087cos((360.00.0*daynum)/365.25);
float EOT2 = 0.0092869cos((360.01.0daynum)/365.25) - 0.12229sin((360.01.0daynum)/365.25);
float EOT3 = (-1.0)0.052258cos((360.02.0daynum)/365.25) - 0.15698sin((360.02.0*daynum)/365.25);
float EOT4 = (-1.0)0.0013077cos((360.03.0daynum)/365.25) -
0.0051602sin((360.03.0*daynum)/365.25);
float EOT5 = (-1.0)0.0021867cos((360.04.0daynum)/365.25) -
0.0029823sin((360.04.0*daynum)/365.25);
float EOT6 = (-1.0)0.000151cos((360.05.0daynum)/365.25) -
0.00023463sin((360.05.0*daynum)/365.25);
float EOT = 60.0*(EOT1+EOT2+EOT3+EOT4+EOT5+EOT6);
//float xfractiondeg = 360.0*(daynumber -1)/(365.242);
//float xfraction = xfractiondeg*PI/180.0;
//float EOT = 0.258cos(xfraction)-7.416sin(xfraction)-3.648cos(2xfraction)-9.228sin(2xfraction);
float LC = (18.865-30.0)/15.0;
float LCT = Hourval + Minuteval/60.0 + Secondval/3600.0;
float solartime = LCT + (EOT/60.0) + LC;
Serial.print("Solar time: ");Serial.println(solartime);
float phi = -33.9284*PI/180.0;
float omega = 15.0*(solartime-12.0)*PI/180.0;
float delta = asin(0.39795cos(0.98563(daynumber-173.0)*PI/180.0));
float alpha = asin(sin(delta)*sin(phi)+cos(delta)*cos(omega)*cos(phi));
float zenith = (PI/2.0)-alpha;
float azimuthtemp = acos((sin(delta)*cos(phi)-cos(delta)*cos(omega)*sin(phi))/cos(alpha));
float azimuth = 0.0;
if (sin(omega)>0.0)
{
azimuth = 2.0*PI - azimuthtemp;
}
else if (sin(omega) <= 0.0)
{
azimuth = azimuthtemp;
}
Serial.print("Azimuth: ");Serial.println(azimuth,4);
Serial.print("Zenith: ");Serial.println(zenith,4);
if (zenith<(PI/2.0) && azimuth != 0.0)
{
float rho = PI/2.0 - atan((sin((PI/2.0)-zenith))/(cos((PI/2.0)-zenith)*sin(azimuth)));
float azimuthadj =0.0;
if (azimuth <= PI)
{
azimuthadj = azimuth;
}
else if (azimuth > PI)
{
_ azimuthadj = 2.0PI-azimuth;_
}
float sunangle = 0.0;
float tempsun = 0.0;
float tiltangle =0.0;
if (azimuth <= PI)
{
tempsun = rho;
tiltangle = PI/2.0 - atan((sin((PI/2.0)-zenith))/(cos((PI/2.0)-zenith)*cos(azimuthadj)));
}
else if (azimuth > PI)
{
_tempsun = (-1.0)
(PI-rho);_
tiltangle = (-1.0)*PI/2.0 - atan((sin((PI/2.0)-zenith))/(cos((PI/2.0)-zenith)*sin(azimuthadj)));
}
sunangle = (PI - tempsun)*180.0/PI;
float theta = (phimirror - tempsun)/2.0;
float normalpos = (PI + theta)*180.0/PI;
Serial.print("Tempsun: ");Serial.println(tempsun,4);
Serial.print("Sunangle: ");Serial.println(sunangle,4);
Serial.print("Tiltangle: ");Serial.println(tiltangle,4);
Serial.print("Rho: ");Serial.println(rho,4);
Serial.print("Theta: ");Serial.println(theta,4);
Serial.print("Normalpos: ");Serial.println(normalpos,4);
Serial.print("Motorpos: ");Serial.println(motorpos,4);
if (motorpos < 1.0 || normalpos < motorpos + 5.0)
{
while (motorpos < normalpos)
{
digitalWrite(8,LOW);
delay(5);
digitalWrite(8,HIGH);
delay(5);
Serial.print(“1”);
motorpos = motorpos + stepsize;
limitswitch3 = 0;
}
}
Serial.println(“end”);
Serial.print("New motorpos: ");Serial.println(motorpos);
}
else
{
// Do nothing
}
}// End if time vals and date vals positive
} // End if string populated
}// End if endpos and startpos
} // End if serial available
} // End Elseif pin 10 == LOW first check
} // End loop

Não acha que devia ler as regras do fórum antes de postar? Da minha parte, se coloca o código dessa forma, a minha contribuição acabou aqui. Boa sorte!

Desculpe e obrigada pela atenção até aqui!

#include <icrmacros.h>
#include <SoftwareSerial.h>
float stepsize = 1.8/50.0;
float motorpos = 0.0;
float phimirror = atan(120.0/2080.0);
int limitswitch3 = 0;
SoftwareSerial mySerial(2,3);
void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  digitalWrite(13, LOW);
  pinMode(8, OUTPUT);
  pinMode(6, INPUT);
  pinMode(7, OUTPUT);
  pinMode(10, INPUT);
  digitalWrite(8, HIGH);
  digitalWrite(7, HIGH);
  pinMode(2, INPUT);
  mySerial.begin(9600);
  int limitiswitch = 0;
  while (limitswitch != 1) 
 {
 digitalWrite(8,LOW);
 delay(5);
 digitalWrite(8,HIGH);
 delay(5);
 //Serial.print("1");
 if (digitalRead(6) == LOW)
 {
 delay(1000);
 if (digitalRead(6) == LOW)
 {
 limitswitch = 1; 
limitswitch3 =1;
 }
 }
 }
 motorpos = 0.0;
 Serial.println("End setup");
 digitalWrite(13,HIGH);
} 
// MAIN LOOP
void loop()
{
 int serialStringPosition;
 char inByte;
 char serialString[250];
 const char beginChar = '*';

 int commaPosition =0;
 int commaString[20];
 int numCommas = 0;

 for (int j=0;j<20;j++)
 {
 commaString[j] = 0;
 }
 for (int i=0;i<250;i++)
 {
 serialString[i] = ' ';
 }
 if (digitalRead(10) == LOW)
 {
 delay(2000);
 if (digitalRead(10) == LOW)
 {
 delay(3000);
 if (digitalRead(10) == LOW)
 {
 while (limitswitch3 != 1)
 {
 digitalWrite(8,LOW);
 delay(5);
 digitalWrite(8,HIGH);
 delay(5);
 Serial.print("1");
 if (digitalRead(6) == LOW)
 {
 delay(1000);
 if (digitalRead(6) == LOW)
 {
 limitswitch3 = 1;
 }
 }
 }
 Serial.println("No track");
 motorpos = 0.0;
 Serial.print("New motorpos: ");Serial.println(motorpos);
 }
 }
 }
 else{

 if (mySerial.available())
 {
 delay(1);
 serialStringPosition =0;
 //while (mySerial.available())
 //{
 for (int j=0;j<250;j++)
 {
 inByte = mySerial.read();
 serialString[j] = inByte;
 delay(1);
 }
 //}

 Serial.println(serialString);
 int endpos = 0;
 int startpos = 0;

 for (int k=0;k<250;k++)
 {
 if (serialString[k] == '

&& serialString[k+1] == ‘G’ && serialString[k+2] == ‘P’)
{
if (serialString[k+3] == ‘Z’ && serialString[k+4] == ‘D’ && serialString[k+5] == ‘A’)
{
Serial.println(“Right string”);
Serial.println(k);
startpos = k;
char checkByte = serialString[k];
endpos = k;
while (checkByte != '’)
{
endpos++;
checkByte = serialString[endpos];
}
Serial.println(endpos);
}// End if ZDA
}// End if $GP
}// End for
if (endpos != 0 && startpos != 0)
{
for (int l=startpos;l<endpos;l++)
{
char currentChar = serialString[l];
if (currentChar == ‘,’)
{
commaString[numCommas] = l;
numCommas++;
}
}
int checkGPS1 = commaString[0] +1;
int checkGPS2 = commaString[1];
int checkGPS3 = commaString[2] +1;
int checkGPS4 = commaString[3];
if (checkGPS1 == checkGPS2 || checkGPS3 == checkGPS4)
{
Serial.println(“GPS not locked on”);
} else
{
Serial.println(“GPS locked on”);
int h1 = serialString[commaString[0]+1];
int h2 = serialString[commaString[0]+2];
int m1 = serialString[commaString[0]+3];
int m2 = serialString[commaString[0]+4];
int s1 = serialString[commaString[0]+5];
int s2 = serialString[commaString[0]+6];
int D1 = serialString[commaString[1]+1];
int D2 = serialString[commaString[1]+2];
int M1 = serialString[commaString[2]+1];
int M2 = serialString[commaString[2]+2];
int Y1 = serialString[commaString[3]+1];
int Y2 = serialString[commaString[3]+2];
int Y3 = serialString[commaString[3]+3];
int Y4 = serialString[commaString[3]+4];
int Hourval = 10
(h1-48) + (h2-48)+ 2;
int Minuteval = 10*(m1-48) + (m2-48);
int Secondval = 10*(s1-48) + (s2-48);
int Yearval = 1000*(Y1-48)+100*(Y2-48)+10*(Y3-48) + (Y4-48);
int Monthval = 10*(M1-48) + (M2-48);
int Dayval = 10*(D1-48) + (D2-48);
Serial.print("Hour: ");Serial.println(Hourval);
Serial.print("Minute: ");Serial.println(Minuteval);
Serial.print("Second: ");Serial.println(Secondval);
//
if (Hourval >0 && Minuteval >0 && Secondval>0 && Yearval >0 && Monthval >0 && Dayval >0)
{
float leapyearcheck1 = Yearval/4.0;
float leapyearcheck2 = Yearval/4;
int leapyear = 0;
if (leapyearcheck1 == leapyearcheck2)
{
leapyear = 1;
} else
{
leapyear = 0;
}
int daynumber = 1;
switch (Monthval) {
case 1:
daynumber = Dayval;
break;
case 2:
daynumber = Dayval + 31;
break;
case 3:
daynumber = Dayval + 59 +leapyear;
break;
case 4:
daynumber = Dayval + 90 +leapyear;
break;
case 5:
daynumber = Dayval + 120 +leapyear;
break;
case 6:
daynumber = Dayval + 151 +leapyear;
break;
case 7:
daynumber = Dayval + 181 +leapyear;
break;
Stellenbosch University http://scholar.sun.ac.za
118
case 8:
daynumber = Dayval + 212 +leapyear;
break;
case 9:
daynumber = Dayval + 243 +leapyear;
break;
case 10:
daynumber = Dayval + 273 +leapyear;
break;
case 11:
daynumber = Dayval + 304 +leapyear;
break;
case 12:
daynumber = Dayval + 334 +leapyear;
break;
}

int daynum = 1;
switch(Yearval) {
case 2012:
daynum = daynumber;
break;
case 2013:
daynum = daynumber + 366;
break;
case 2014:
daynum = daynumber + 731;
break;
case 2015:
daynum = daynumber +1096;
break;
case 2016:
daynum = daynumber;
break;
case 2017:
daynum = daynumber + 366;
break;
case 2018:
daynum = daynumber + 731;
break;
case 2019:
daynum = daynumber + 1096;
break;
default:
daynum = daynumber;
}
float EOT1 = 0.0002087cos((360.00.0daynum)/365.25);
float EOT2 = 0.0092869
cos((360.01.0daynum)/365.25) - 0.12229sin((360.01.0daynum)/365.25);
float EOT3 = (-1.0)0.052258cos((360.0
2.0daynum)/365.25) - 0.15698sin((360.02.0daynum)/365.25);
float EOT4 = (-1.0)0.0013077cos((360.03.0daynum)/365.25) -
0.0051602sin((360.03.0daynum)/365.25);
float EOT5 = (-1.0)0.0021867cos((360.0
4.0daynum)/365.25) -
0.0029823
sin((360.04.0daynum)/365.25);
float EOT6 = (-1.0)0.000151cos((360.05.0daynum)/365.25) -
0.00023463sin((360.05.0daynum)/365.25);
float EOT = 60.0
(EOT1+EOT2+EOT3+EOT4+EOT5+EOT6);
//float xfractiondeg = 360.0*(daynumber -1)/(365.242);
//float xfraction = xfractiondegPI/180.0;
//float EOT = 0.258
cos(xfraction)-7.416sin(xfraction)-3.648cos(2xfraction)-9.228sin(2xfraction);
float LC = (18.865-30.0)/15.0;
float LCT = Hourval + Minuteval/60.0 + Secondval/3600.0;
float solartime = LCT + (EOT/60.0) + LC;
Serial.print("Solar time: ");Serial.println(solartime);
float phi = -33.9284
PI/180.0;
float omega = 15.0*(solartime-12.0)PI/180.0;
float delta = asin(0.39795
cos(0.98563*(daynumber-173.0)*PI/180.0));
float alpha = asin(sin(delta)*sin(phi)+cos(delta)*cos(omega)*cos(phi));
float zenith = (PI/2.0)-alpha;
float azimuthtemp = acos((sin(delta)*cos(phi)-cos(delta)*cos(omega)sin(phi))/cos(alpha));
float azimuth = 0.0;
if (sin(omega)>0.0)
{
azimuth = 2.0
PI - azimuthtemp;
}
else if (sin(omega) <= 0.0)
{
azimuth = azimuthtemp;
}
Serial.print("Azimuth: ");Serial.println(azimuth,4);
Serial.print("Zenith: ");Serial.println(zenith,4);
if (zenith<(PI/2.0) && azimuth != 0.0)
{
float rho = PI/2.0 - atan((sin((PI/2.0)-zenith))/(cos((PI/2.0)-zenith)sin(azimuth)));
float azimuthadj =0.0;
if (azimuth <= PI)
{
azimuthadj = azimuth;
}
else if (azimuth > PI)
{
  azimuthadj = 2.0
PI-azimuth;
}
float sunangle = 0.0;
float tempsun = 0.0;
float tiltangle =0.0;
if (azimuth <= PI)
{
tempsun = rho;
tiltangle = PI/2.0 - atan((sin((PI/2.0)-zenith))/(cos((PI/2.0)-zenith)cos(azimuthadj)));
}
else if (azimuth > PI)
{
tempsun = (-1.0)
(PI-rho);
tiltangle = (-1.0)*PI/2.0 - atan((sin((PI/2.0)-zenith))/(cos((PI/2.0)-zenith)*sin(azimuthadj)));
}
sunangle = (PI - tempsun)*180.0/PI;
float theta = (phimirror - tempsun)/2.0;
float normalpos = (PI + theta)*180.0/PI;
Serial.print("Tempsun: ");Serial.println(tempsun,4);
Serial.print("Sunangle: ");Serial.println(sunangle,4);
Serial.print("Tiltangle: ");Serial.println(tiltangle,4);
Serial.print("Rho: ");Serial.println(rho,4);
Serial.print("Theta: ");Serial.println(theta,4);
Serial.print("Normalpos: ");Serial.println(normalpos,4);
Serial.print("Motorpos: ");Serial.println(motorpos,4);
if (motorpos < 1.0 || normalpos < motorpos + 5.0)
{
while (motorpos < normalpos)
{
digitalWrite(8,LOW);
delay(5);
digitalWrite(8,HIGH);
delay(5);
Serial.print(“1”);
motorpos = motorpos + stepsize;
limitswitch3 = 0;
}
}
Serial.println(“end”);
Serial.print("New motorpos: ");Serial.println(motorpos);

}
else
{
// Do nothing
}
}// End if time vals and date vals positive
} // End if string populated
}// End if endpos and startpos
} // End if serial available
} // End Elseif pin 10 == LOW first check
} // End loop