-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathExtra_Functions
65 lines (52 loc) · 1.44 KB
/
Extra_Functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// ***************************************
// Custom Functions
// ***************************************
void useInterrupt(boolean v) {
if (v) {
// Timer0 is already used for millis() - we'll just interrupt somewhere
// in the middle and call the "Compare A" function above
OCR0A = 0xAF;
TIMSK0 |= _BV(OCIE0A);
usingInterrupt = true;
}
else {
// do not call the interrupt function COMPA anymore
TIMSK0 &= ~_BV(OCIE0A);
usingInterrupt = false;
}
}
SIGNAL(TIMER0_COMPA_vect) {
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
char c = GPS.read();
// if you want to debug, this is a good time to do it!
#ifdef UDR0
if (GPSECHO)
if (c) UDR0 = c;
// writing direct to UDR0 is much much faster than Serial.print
// but only one character can be written at a time.
#endif
}
void Send_SMS(char* Input)
//void Send_SMS(String Input)
{
sms.beginSMS("+441724411037");
sms.print(Input);
sms.endSMS();
}
double convertDegMinToDecDeg (float degMin) {
double min = 0.0;
double decDeg = 0.0;
//get the minutes, fmod() requires double
min = fmod((double)degMin, 100.0);
//rebuild coordinates in decimal degrees
degMin = (int) ( degMin / 100 );
decDeg = degMin + ( min / 60 );
return decDeg;
}
void gsmOnOff() {
// Takes 30 seconds to complete
digitalWrite(5, HIGH); // turn the Phone on
delay(5000);
digitalWrite(5, LOW);
//delay(5000);
}