Store in GIT
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
Mens.cpp
|
||||
Copyright (c) 2014 Kenneth van Ewijk. All right reserved.
|
||||
*/
|
||||
|
||||
// include this library's description file
|
||||
#include "Mens.h"
|
||||
|
||||
Mens::Mens(void)
|
||||
{
|
||||
// initialize this instance's variables
|
||||
pattern[80][3];
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
|
||||
//Set Heater Properties
|
||||
void Mens::setPattern(int givenPattern[80][3], int len)
|
||||
{
|
||||
pattern[80][3] = givenPattern[80][3];
|
||||
}
|
||||
|
||||
int Mens::getTimeToEnter(int givenTime){
|
||||
int timer = givenTime % 25200;
|
||||
|
||||
int enter = pattern[counter][0];
|
||||
int room = pattern[counter][1];
|
||||
int leave = pattern[counter][2];
|
||||
|
||||
if(timer > leave){
|
||||
counter++;
|
||||
}
|
||||
|
||||
int rtn[2] = {enter-timer, room};
|
||||
|
||||
if(rtn[0] < 0 && rtn[1]==0){
|
||||
rtn[2] = getTimeToEnter(timer);
|
||||
}
|
||||
|
||||
return rtn[2];
|
||||
}
|
||||
|
||||
int Mens::getTimeToLeave(int givenTime){
|
||||
int timer = givenTime % 25200;
|
||||
|
||||
int enter = pattern[counter][0];
|
||||
int room = pattern[counter][1];
|
||||
int leave = pattern[counter][2];
|
||||
|
||||
if(timer > leave){
|
||||
counter++;
|
||||
}
|
||||
|
||||
int rtn[2] = {leave-timer, room};
|
||||
|
||||
if(rtn[0] < 0 && rtn[1]==0){
|
||||
rtn[2] = getTimeToEnter(timer);
|
||||
}
|
||||
|
||||
return rtn[2];
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Mens.h
|
||||
Copyright (c) 2014 Kenneth van Ewijk. All right reserved.
|
||||
*/
|
||||
|
||||
// ensure this library description is only included once
|
||||
#ifndef Mens_h
|
||||
#define Mens_h
|
||||
|
||||
// library interface description
|
||||
class Mens
|
||||
{
|
||||
// user-accessible "public" interface
|
||||
public:
|
||||
Mens(void);
|
||||
void setPattern(int[80][3], int);
|
||||
int getTimeToEnter(int);
|
||||
int getTimeToLeave(int);
|
||||
private:
|
||||
int pattern[80][3];
|
||||
int counter;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <Mens.h>
|
||||
|
||||
// Library for "Mens"
|
||||
// by Kenneth van Ewijk <http://www.kennyboy.nl>
|
||||
|
||||
// Demostrates how to do something with the Mens library
|
||||
|
||||
// Created 5 April 2014
|
||||
|
||||
Mens kenneth = Mens();
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
kenneth.setPattern({ {0,1,500}, {600,2,800}, {800,1,3600}, {3800,4,4000} });
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
//Do stuff with a person
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Mens KEYWORD1
|
||||
|
||||
setPattern KEYWORD2
|
||||
setTimeToEnter KEYWORD2
|
||||
setTimeToLeave KEYWORD2
|
||||
@@ -0,0 +1,39 @@
|
||||
This is an example C++ library for Arduino 0004+, based on one created by
|
||||
Nicholas Zambetti for Wiring 0006+
|
||||
|
||||
Installation
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
To install this library, just place this entire folder as a subfolder in your
|
||||
Arduino/lib/targets/libraries folder.
|
||||
|
||||
When installed, this library should look like:
|
||||
|
||||
Arduino/lib/targets/libraries/Test (this library's folder)
|
||||
Arduino/lib/targets/libraries/Test/Test.cpp (the library implementation file)
|
||||
Arduino/lib/targets/libraries/Test/Test.h (the library description file)
|
||||
Arduino/lib/targets/libraries/Test/keywords.txt (the syntax coloring file)
|
||||
Arduino/lib/targets/libraries/Test/examples (the examples in the "open" menu)
|
||||
Arduino/lib/targets/libraries/Test/readme.txt (this file)
|
||||
|
||||
Building
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
After this library is installed, you just have to start the Arduino application.
|
||||
You may see a few warning messages as it's built.
|
||||
|
||||
To use this library in a sketch, go to the Sketch | Import Library menu and
|
||||
select Test. This will add a corresponding line to the top of your sketch:
|
||||
#include <Test.h>
|
||||
|
||||
To stop using this library, delete that line from your sketch.
|
||||
|
||||
Geeky information:
|
||||
After a successful build of this library, a new file named "Test.o" will appear
|
||||
in "Arduino/lib/targets/libraries/Test". This file is the built/compiled library
|
||||
code.
|
||||
|
||||
If you choose to modify the code for this library (i.e. "Test.cpp" or "Test.h"),
|
||||
then you must first 'unbuild' this library by deleting the "Test.o" file. The
|
||||
new "Test.o" with your code will appear after the next press of "verify"
|
||||
|
||||
Reference in New Issue
Block a user