Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IOT Assessment
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jack.templeman
IOT Assessment
Commits
c1b8136d
Commit
c1b8136d
authored
Jan 05, 2021
by
jack.templeman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parents
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
project
project
+40
-0
No files found.
project
0 → 100644
View file @
c1b8136d
const int switchP = 8;
int led = 2;
int switchS = 0;
int prevSwitchS = 0;
unsigned long pTime = 0;
long duration = 600000; //this is the interval for each LED (600000 being 10 minutes)
void setup() {
for(int x = 2; x<8;x++) {
pinMode(x, OUTPUT);
}
pinMode(switchP, INPUT);
}
void loop() {
unsigned long cTime = millis(); //this is the timer
if(cTime - pTime > duration){
digitalWrite(led, HIGH); //turns the LED on if the duration has been completed
pTime = cTime; //resets duration to 0
led++;
if(led ==7){ //stops at the last LED
}
}
switchS = digitalRead(switchP); //handles the switch reset
if(switchS != prevSwitchS){
for(int y = 2; y<8;y++){
digitalWrite(y, LOW);}
led = 2;
pTime = cTime;
}
prevSwitchS = switchS;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment