verzameling oude spullen

This commit is contained in:
Manfred 2017-07-09 19:58:38 +02:00
commit 7ed9544283
119 changed files with 1288059 additions and 0 deletions

View file

@ -0,0 +1,41 @@
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <Password.h>
#include "safetyboard.h";
void setup() {
pinMode(airAssistPin, OUTPUT); // sets the digital pin as output
pinMode(ventilationPin, OUTPUT); // sets the digital pin as output
pinMode(waterCoolerPin, OUTPUT); // sets the digital pin as output
pinMode(laserEnablePin, OUTPUT); // sets the digital pin as output
pinMode(lichtPin, OUTPUT); // sets the digital pin as output
pinMode(testEnablePin, OUTPUT); // sets the digital pin as output
pinMode(potMeterEnable, OUTPUT); // sets the digital pin as output
digitalWrite(airAssistPin, LOW); // sets the airAssist on
digitalWrite(ventilationPin, LOW); // sets the air ventilation on
digitalWrite(waterCoolerPin, LOW); // sets the watercooler on
digitalWrite(laserEnablePin, LOW); // sets the laserEnable on
digitalWrite(lichtPin, HIGH); // sets the licht pin (inverted) on
digitalWrite(testEnablePin, LOW); // sets the test enable pin ()
digitalWrite(potMeterEnable, LOW); // sets the watercooler fans on
Serial.begin(9600);
lcd.begin(16, 4); // set up the LCD's number of columns and rows:
lcd.setCursor(0, 0);
lcd.print("Bitlair lasercutter"); // Print a message to the LCD.
lcd.setCursor(0, 1);
lcd.print("Password?");
lcd.setCursor(0, 2);
lcd.print("Press * to confirm");
kpd.addEventListener(pwdKeypadEvent); //add an event listener for this keypad
}
void loop() {
if (passwordCorrect) {
checkMenu();
checkFlow();
} else {
kpd.getKey();
}
}

View file

@ -0,0 +1,30 @@
//*******************************************************
// FlowMeter
//*******************************************************
void setupFlowMeter() {
pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input
attachInterrupt(0, pulseCounter, RISING); //and the interrupt is attached
loopTime = millis();
sei(); //enable interupts
}
void pulseCounter() { //This is the function that the interupt calls
pulseCount++; //This function measures the rising and falling edge of the hall effect sensors signal
}
void checkFlow() {
if(millis() >= (loopTime + 2000)){
Calc = (pulseCount * 60 / (7.5 * 2)); //(Pulse frequency x 60) / 7.5Q, = flow rate in L/hour
Serial.print (Calc, DEC); //Prints the number calculated above
Serial.print (" L/hour\r\n"); //Prints "L/hour" and returns a new line
lcd.setCursor(18, 3);
lcd.print(" "); //Prints the number calculated above
//lcd.setCursor(15, 1);
//lcd.print(millis()/1000);
lcd.setCursor(11, 3);
lcd.print(Calc, DEC); //Prints the number calculated above
lcd.print (" L/h "); //Prints "L/hour" a
//lcd.print(pulseCount);
//lcd.print (" "); //Prints "L/hour" a
pulseCount = 0;
loopTime = millis();; // Updates loopTime
}
}

View file

@ -0,0 +1,78 @@
//******************************************************
// M
//******************************************************
void getInfo() {
//HERE WE WILL GET THE INFO LIKE TEMP etc
}
void checkMenu() {
lcd.setCursor(0,0);
lcd.print("press * for info ");
lcd.setCursor(0,1);
lcd.print("1 air-assist 2 vent");
lcd.setCursor(0,2);
lcd.print("3 watercool 4 laser");
lcd.setCursor(0,3);
lcd.print("0 off 9 on");
char key = kpd.getKey();
}
void menuKeypadEvent(KeypadEvent eKey) {
switch (kpd.getState()){
case PRESSED:
switch (eKey){
case '*':
getInfo();
break;
case '#':
password.reset();
break;
case '0':
digitalWrite(airAssistPin, LOW);
digitalWrite(ventilationPin, LOW);
digitalWrite(waterCoolerPin, LOW);
digitalWrite(laserEnablePin, LOW);
digitalWrite(lichtPin, HIGH); // sets the licht pin (inverted) on
digitalWrite(testEnablePin, LOW); // sets the test enable pin ()
digitalWrite(potMeterEnable, LOW); // sets the watercooler fans on
break;
case '9':
digitalWrite(airAssistPin, HIGH);
digitalWrite(ventilationPin, HIGH);
digitalWrite(waterCoolerPin, HIGH);
digitalWrite(laserEnablePin, HIGH);
digitalWrite(lichtPin, LOW); // sets the licht pin (inverted) on
// digitalWrite(testEnablePin, LOW); // sets the test enable pin ()
// digitalWrite(potMeterEnable, LOW); // sets the watercooler fans on
break;
case '1':
digitalWrite(airAssistPin, !digitalRead(airAssistPin));
break;
case '2':
digitalWrite(ventilationPin, !digitalRead(ventilationPin));
break;
case '3':
digitalWrite(waterCoolerPin, !digitalRead(waterCoolerPin));
break;
case '4':
digitalWrite(laserEnablePin, !digitalRead(laserEnablePin));
break;
case '5':
digitalWrite(lichtPin, !digitalRead(lichtPin));
break;
case '6':
digitalWrite(testEnablePin, !digitalRead(testEnablePin));
break;
case '7':
digitalWrite(potMeterEnable, !digitalRead(potMeterEnable));
break;
default:
password.append(eKey);
}
}
}

View file

@ -0,0 +1 @@
//

View file

@ -0,0 +1,47 @@
//#include "safetyboard.h";
//******************************************************
// Password related stuff
//******************************************************
//take care of some special events
void pwdKeypadEvent(KeypadEvent eKey) {
switch (kpd.getState()){
case PRESSED:
Serial.print("Pressed: ");
Serial.println(eKey);
lcd.setCursor(0, 4);
lcd.print(" "); //empty "Wrong"
switch (eKey){
case '*':
checkPassword();
break;
case '#':
password.reset();
break;
default:
password.append(eKey);
}
}
}
void checkPassword() {
if (password.evaluate()) {
Serial.println("Success");
passwordCorrect = true;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Menu"); // Print a message to the LCD.
setupFlowMeter();
digitalWrite(airAssistPin, HIGH); // sets the airAssist on
digitalWrite(ventilationPin, HIGH); // sets the air ventilation on
digitalWrite(waterCoolerPin, HIGH); // sets the watercooler fans on
digitalWrite(laserEnablePin, HIGH); // sets the watercooler fans on
kpd.addEventListener(menuKeypadEvent); //add an event listener for this keypad
} else {
Serial.println("Wrong");
password.reset();
lcd.setCursor(0, 4);
lcd.print("Wrong");
}
}

View file

@ -0,0 +1,47 @@
void pulseCounter(); //
void setupFlowMeter(); //
void checkFlow() ;
void getInfo(); //here we get info like temp etc
void checkMenu();
void pwdKeypadEvent();
void menuKeypadEvent();
int laserEnablePin = 50;
int waterCoolerPin = 51;
int airAssistPin = 52;
int ventilationPin = 53;
int lichtPin = 49;
//int lichtPin = 48; spare
int testEnablePin = 47;
int potMeterEnable = 46;
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
int passwordCorrect = false;
Password password = Password( "123456" );
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
char keys[ROWS][COLS] = { // Define the Keymap
{ '1','2','3' } ,
{ '4','5','6' } ,
{ '7','8','9' } ,
{ '*','0','#' } };
byte rowPins[ROWS] = { 15, 20, 17, 19 }; // Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 18, 14, 16 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); // Create the Keypad
float tempIn;
float tempOut;
int tempPinIn = 0;
int tempPinOut = 0;
volatile int pulseCount; //measuring the rising edges of the signal
int Calc;
int hallsensor = 2; //The pin location of the sensor
unsigned long loopTime;