View on GitHub


Stupid Pet Trick: The Nurse Station

The Nurse Station is a beer nursing meter. It goes placed on a bar counter and is used to measure if the person who places their beer on the coaster has left their beer too long on the counter.


Stupid Pet Trick: The Nurse Station from Zeven Rodriguez on Vimeo.


Stupid Pet Trick: Internals from Zeven Rodriguez on Vimeo.

Here is the code

*#include Servo servoMotor;*

int fsrPin = 0; // Analog input pin that the potentiometer is attached to
int fsrValue = 0; // value read from the pot
int fsrRef = 10; // value read from the pot
int redLed = 4;
int yellowLed = 3;
int greenLed = 2;
int servoPin = 8;
long time = 0;
long lastTime = 0;
boolean setTime=true;

void setup() {
// initialize serial communications at 9600 bps:
// declare the led pin as an output:
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(yellowLed, OUTPUT);
//pinMode(speakerPin, OUTPUT);
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
// pulse = minPulse;


void loop() {

fsrValue = analogRead(fsrPin); // read the pot value
if(fsrValue < 60){
digitalWrite(redLed, LOW);
digitalWrite(yellowLed, LOW);
digitalWrite(greenLed, LOW);
// Serial.println(“this is when the fsr is not pressed”);
// Serial.println(lastTime);


if(fsrValue > 60 && setTime == true){
lastTime= millis();
//Serial.println(“START TIMER”);

if(fsrValue > 60) {
if(millis() – lastTime < 5000){
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, LOW);
digitalWrite(yellowLed, LOW);

if((millis() – lastTime >= 5000) && (millis() – lastTime <10000)){

digitalWrite(greenLed, LOW);
digitalWrite(redLed, LOW);
digitalWrite(yellowLed, HIGH);
// Serial.println(“TEN SECOND LOOP”);

if (millis() – lastTime >= 10000 ){
//Serial.println(“20 SECOND LOOP”);

digitalWrite(yellowLed, LOW);
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);


The next step is to re-implement the code not using the Servo.h library so I could add tone. Because tone and servo libraries use the internal timers of the arduino it makes the servo movement erratic. Also I could like to make a more mobile unit.