Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Arduino-Programm zum Paketzustellungsdetektor

View paket.ino
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 38 39 40 41 42 43 44
/*
Paketzustellungsdetektor
MobileGeeks DIY
Matthias Lindholm
http://mobilegeeks.de/diy
*/
 
#define FSR_GRENZWERT 15
#define ONBOARD_LED 13
#define FORCE_SENSOR 0
 
int force_value = 0;
byte force_state = 0;
 
void setup() {
Serial.begin(9600);
pinMode(ONBOARD_LED, OUTPUT);
}
 
void loop() {
delay(1000);
force_value = analogRead(FORCE_SENSOR);
switch (force_state){
case 0:
if (force_value >= FSR_GRENZWERT)
{
force_state = 1;
digitalWrite(ONBOARD_LED, HIGH);
Serial.print("Paket abgelegt");
}
break;
case 1:
if (force_value < FSR_GRENZWERT)
{
force_state = 0;
digitalWrite(ONBOARD_LED, LOW);
Serial.print("Paket aufgenommen");
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.