Skip to content

Instantly share code, notes, and snippets.

@jakewins
Created September 21, 2013 09:45
Show Gist options
  • Select an option

  • Save jakewins/6648977 to your computer and use it in GitHub Desktop.

Select an option

Save jakewins/6648977 to your computer and use it in GitHub Desktop.

Revisions

  1. jakewins created this gist Sep 21, 2013.
    33 changes: 33 additions & 0 deletions BBQ Controller
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    const int fanPin = 5; // The arduino connector that controls the motor relay
    const int tempSensorPin = 1; // The arduino connector that is connected to our thermistor

    const short targetTemperature = 15760; // 15760 from thermistor = 107C, or 224F

    short currentTemperature;

    void setup() {
    // This sets the arduino up to talk to my laptop, to let it send temperature readings
    Serial.begin(9600);
    }

    void loop() {

    // Get the temperature from the thermistor
    currentTemperature = (1023 * 16 - analogRead(tempSensorPin));

    // Send temp reading to my laptop
    Serial.println(currentTemperature);


    if(currentTemperature < targetTemperature)
    {
    analogWrite(fanPin, 255); // Turn fan on
    }
    else
    {
    analogWrite(fanPin, 0); // Turn fan off
    }

    // Wait for 2000 milliseconds, 2 seconds
    delay(2000);
    }