-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUtility.cpp
More file actions
37 lines (30 loc) · 824 Bytes
/
Utility.cpp
File metadata and controls
37 lines (30 loc) · 824 Bytes
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
/* Utility Functions
*
* Delay(interval) - non-blocking delahy
*/
#include "Arduino.h"
#include "Utility.h"
/*
* "Delay" is a non-blocking delay function. The standard Arduino "delay" function
* turns off interrupts, which prevents the Serial I/O functions from working. That
* sometimes causes characters to be missed and junk commands to show up.
*/
void Delay ( unsigned long interval )
{
unsigned long currentTime = 0UL;
unsigned long startTime = millis();
while ( startTime + interval > currentTime )
currentTime = millis();
}
/*
* ToggleLED - toggles built-in LED On/Off - useful for debug
*/
byte LEDState=LOW;
void ToggleLED(){
if (LEDState == LOW){
LEDState = HIGH;
} else {
LEDState = LOW;
}
digitalWrite(LED_BUILTIN, LEDState);
}