Sprzątnięte...

master
minimal2 2013-06-18 16:59:23 +02:00
parent 34629be0d2
commit a60e11edd6
1 changed files with 0 additions and 62 deletions

View File

@ -1,62 +0,0 @@
#include<SPI.h>
#include"RFID.h"
const int chipSelectPin = 10;
const int NRSTPD = 5;
const int scalePin = A0;
const int speakerPin = A1;
const int flowMeterPin = A2;
int sample = 120;
int stp = 0;
unsigned long int sum = 0;
int isFlow;
int recivedByte;
RFID rfid(chipSelectPin, NRSTPD)
void setup() {
Serial.begin(9600);
SPI.begin();
pinMode(speakerPin, OUTPUT);
analogWrite(speakerPin, 0);
pinMode(flowMeterPin, INPUT);
pinMode(scalePin, INPUT)
rfid.init()
}
void alarm() {
tone(speakerPin, 9600, 3200);
}
void loop() {
if (stp == sample) {
int weight = sum / sample;
isFlow = analogRead(flowMeterPin);
if (isFlow != 0) {
if (rfid.isCard()) {
if (rfid.readCardSerial()) {
Serial.print(weight);
Serial.print("; ");
Serial.print(rfid.serNum[0]);
Serial.print(rfid.serNum[1]);
Serial.print(rfid.serNum[2]);
Serial.println(rfid.serNum[3]);
}
while (Serial.available() > 0) {
recivedByte = Serial.read();
if (recivedByte == 'a') {
alarm()
}
}
} else {
Serial.println(weight);
alarm();
}
rfid.halt();
}
stp = 0;
sum = 0;
} else {
sum += analoRead(scalePin);
stp ++;
}
}