Chest Freezer To Refrigerator Conversion

From Open Source Ecology
Revision as of 00:32, 9 November 2016 by Dorkmo (talk | contribs)
Jump to navigation Jump to search

BOM

Arduino Code

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */

//A1 read voltage
//D3 sensor power
//D5 relay low
//D7 relay high

  volatile int sensorvalue = 330;
  int triggeron = 330;
  int triggeroff = 300;

void setup() {
  digitalWrite(3, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(7, LOW);    // initialize in OFF setting
  digitalWrite(5, LOW);    // set pin 5 low
  pinMode(3, OUTPUT);
  pinMode(7, OUTPUT);
  delay(20000);
}

// the loop function runs over and over again forever
void loop() {
  sensorvalue = analogRead(A1);   // turn the LED on (HIGH is the voltage level)
if (sensorvalue > triggeron){
  digitalWrite(7, HIGH);
  delay(8000);
}
if (triggeroff > sensorvalue){
  digitalWrite(7, LOW);
  delay(8000);
}
}

 

Other Options

Further Reading