Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
George Kartsonas
Created August 12, 2019 © Apache-2.0

Industrial Argon Heavy Equipment

Industrial machinery can last for years, or even decades but that's only if there properly taken care of.

BeginnerShowcase (no instructions)1 hour33
Industrial Argon Heavy Equipment

Things used in this project

Hardware components

Argon
Particle Argon
×1
Grove - Vibration Sensor (SW-420)
Seeed Studio Grove - Vibration Sensor (SW-420)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Code

Vibration Sensor Code

C/C++
#define ON 1
#define OFF 0
 
int vibration_Sensor = A5;
int LED = D7;
 
int present_condition = 0;
int previous_condition = 0;

void setup() {
pinMode(vibration_Sensor, INPUT);
pinMode(LED, OUTPUT);
}
 
void led_blink(void);
 
void loop() {
previous_condition = present_condition;
present_condition = digitalRead(A5); 
if (previous_condition != present_condition) {
led_blink();

Particle.publish ("vibration-detected","Misalignment Detected", PRIVATE);
 
} else {
digitalWrite(LED, OFF);
}
}
 
void led_blink(void) {
digitalWrite(LED, ON);
delay(250);
digitalWrite(LED, OFF);
delay(250);
digitalWrite(LED, ON);
delay(250);
digitalWrite(LED, OFF);
delay(250);
}

Credits

George Kartsonas
19 projects • 46 followers

Comments